mysql_fetch_array.php : mysql_fetch_array « MySQL Database « PHP






mysql_fetch_array.php

 
<?
mysql_connect("localhost","root","");
mysql_select_db("mydatabase");
   
$query = "SELECT id, title FROM mytable ORDER BY title";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
    $title = $row['title'];
    $id = $row['id'];
    echo "Product:  $title ($id) <br />";
}
?>
  
  








Related examples in the same category

1.An Example of Using the Old MySQL Extension
2.while loop and mysql_fetch_array() function
3.Get data from database
4.mysql_fetch_array-2.php
5.Using timestamp with mysql
6.Retrieving and Displaying Results