Hi,

Today we are going to know about how to retrieve data from database.  Here we are using mysql_fetch_array(); to get a particular row values. It stored all values in an array. Then we will call all values by its index names.

Ok. This is our program,

<?php
$dbhost=”localhost”;
     $dbuser=”root”;
     $dbpass=””;
     $conn=mysql_connect($dbhost,$dbuser,$dbpass);
     mysql_select_db(“trainee”);
     $result = mysql_query(“select * from details
     where name=’Guhan'”);
     $row= mysql_fetch_array($result); // It stores values in an array
     for($i=0; $i<3; $i++)
     {
        echo $row[$i].”<br>”;
     }
?>

OUTPUT:

Guhan
Ganesan
979181****