bidvertiser

Wednesday, October 22, 2008

Querying data from a table code

// Make a MySQL Connection
mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());

// Retrieve all the data from the "example" table
$result = mysql_query("SELECT * FROM example")
or die(mysql_error());

// store the record of the "example" table into $row
$row = mysql_fetch_array( $result );
// Print out the contents of the entry

echo "Name: ".$row['name'];
echo " Age: ".$row['age'];

?>

1 comment:

Anonymous said...

Can you please give a step by step direction how I create database on cpanel database area it will be really helpful for us.