Usage of PHP mysql_fetch_array() Function Example

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.

Syntax

<?php
mysql_fetch_array(data,array_type)
?>

Example

<?php
// 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

Tags: ,

Related posts:

HTML5 page structure

HTML5 offers more powerful structure comparing to older versions of Html. There are many new …


Partner with Us

We are providing an exclusive partnership offer to individuals and companies who are interested in setting up their own web design & development company. For more information about how to partner with us, please contact us