Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/05/2007, 08:09
Avatar de HMSJUAN
HMSJUAN
 
Fecha de Ingreso: febrero-2007
Mensajes: 54
Antigüedad: 18 años, 1 mes
Puntos: 1
De acuerdo No entiendo este error?

En realidad yo no le veo ningun error al menos que la tabla no se llame Asi
PEro de tdas forma prueba este codigo---

Código PHP:
<?
// Esta Es Una Funcion que uso siempre en mis scripts
//Si quieres la pones sola en un archivo y usas un include..
//Asi cuando te quiera conectar solo tienes que poner
// conectar() Y Se conecta---

function conectar(){
  
$result = @mysql_connect("localhost""root""");
  if (!
$result)
       return 
false;
    if (!@
mysql_select_db("productos"))
        return 
false;
   return 
$result;
   }
?>
<html>
<head>
<title>Sans Titre</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="HAPedit 2.6">
</head>
<body bgcolor="#FFFFFF">
<?
if conectar(){
$tabla="productos";
$sql="select * from $tabla order by idproductos";
$result=mysql_query($sql);
echo
"<table border>
<tr>
<td<b>idproducto</td>
<td<b>nombre</td>
<td<b>marca</td>
<td<b>existencia</td>
<td<b>comentario</td>
</tr>"
;


while(
$row=mysql_fetch_array($result))
    {
    echo
"<table border>
    <tr>
    <td>$row[idproducto]</td>
    <td>$row[nombre]</td>
    <td>$row[marca]</td>
    <td>$row[existencia]</td>
    <td>$row[comentario]</td>
    </tr>"
;
    }
mysql_close();
}
else 
{
echo 
"No se Pudo Conectar O Algun Error"    

}
?>
</body>
</html>
Pruebalo y me avisas