Home » Labs » Usage of PHP mysql_fetch_array() Function Example  

Usage of PHP mysql_fetch_array() Function Example

Filed under Labs

The mysql_fetch_array() in PHP allows you to retrieve data from mysql_query. IT always returns the first row in a MySQL Resource in the form of an associative/ numeric array.




// Your Connection Code here
$query = "SELECT * FROM Demo_Table"; 
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
echo $row['name']. " - ". $row['age'];

The output will be: James Shadow – 33

It's only fair to share...Share on Google+Tweet about this on TwitterShare on Facebook

Posts you may like: