mysql_fetch_row() fetches rows : mysql_fetch_row « MySQL Database « PHP






mysql_fetch_row() fetches rows

 
Its syntax is: array mysql_fetch_row() (int result)

<?
@mysql_connect("localhost", "root","") or die("Could not connect to MySQL server!");
@mysql_select_db("mydatabase") or die("Could not select database!");
$query = "SELECT * FROM mytable";
$result = mysql_query($query);
print "<table>\n";
print "<tr>\n<th>ID</th><th>Title</th><th>MyValue</th>\n</tr>\n";
while (list($id, $title, $myvalue) = mysql_fetch_row($result)) :
   print "<tr>\n";
   print "<td>$id</td>\n<td>$title</td>\n<td>$myvalue</td>\n";
   print "</tr>\n";
endwhile;
print "</table>";
mysql_close();
?>
  
  








Related examples in the same category

1.mysql_fetch_row.php