note 103000 deleted from function.mysql-fetch-row by danbrown
| From: | danbrown@php.net | Date: | Sat, 19 Mar 2011 15:23:46 +0000 |
| Subject: | note 103000 deleted from function.mysql-fetch-row by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-178008@lists.php.net to get a copy of this message | ||
Note Submitter: Heardo at gmail dot com
----
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<title>Prueba de tabla PHP</title>
</head>
<body>
<?php
if ($link=mysql_connect('localhost','root','')){
echo ("Conectado");
}
else {
echo("Desconectado");
}
if ($db_selected = mysql_select_db ( 'mirador' , $link )){
echo ("Base de datos seleccionada");
}
else {
echo ("Base de datos no seleccionada");
}
if (isset($_GET['ord'])) {
$orden = $_GET['ord'];
} else {
$orden = 1;
}
$query="Select * From comentarios order by $orden";
echo ($query);
$result=mysql_query($query,$link);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
echo("<table border='1'><th><a
href='".$_SERVER['PHP_SELF']."?ord=Apellidos'>Apellidos</a></th><th><a
href='".$_SERVER['PHP_SELF']."?ord=DNI'>DNI</a></th><th><a
href='".$_SERVER['PHP_SELF']."?ord=Nombre'>Nombre</a></th><th><a
href='".$_SERVER['PHP_SELF']."?ord=Telefono'>Telefono</a></th>");
while ($fila = mysql_fetch_row($result)) {
echo('<tr>');
echo('<td>'); echo($fila[3]); echo('</td>');
echo('<td>'); echo($fila[4]); echo('</td>');
echo('<td>'); echo($fila[5]); echo('</td>');
echo('<td>'); echo($fila[6]); echo('</td>');
echo('</tr>');
}
echo('</table>');
mysql_free_result($result);
mysql_close($link);
?>
</body>
</html>