Ver Mensaje Individual
  #4 (permalink)  
Antiguo 11/07/2002, 14:41
Avatar de yampoo
yampoo
 
Fecha de Ingreso: noviembre-2001
Ubicación: Vilanova i la Geltrú
Mensajes: 1.942
Antigüedad: 22 años, 5 meses
Puntos: 0
Re: Conexión MYSQL?

Me da error, éste es el código:

<?
// con esto te conectas
$conn = mysql_connect("localhost", "usuario", "pass");
mysql_select("db");

// con esto ejecutas un query
$rs = mysql_query("SELECT id FROM tabla", $conn);
$fila = mysql_fetch_array($rs);
?>


<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1>
<TR><TD> nick</TD><TD> nombre </TD></TR>
<?php

while($row = mysql_fetch_array($rs)) {
printf("<tr><td> %s</td><td> %s </td></tr>", $row["nick"],$row["nombre"]);
}
mysql_free_result($rs);
mysql_close($fila);
?>
</table>

<center><p><img border="0" src="http://www.dacoyinternet.com/orale/images/logo/logot.gif" width="218" height="53"></p>