Wednesday, May 13, 2009

Retrieving data from the database and printing it on the screen

mysql_connect("localhost","root","") or die ('Error: ' . mysql_error());
mysql_select_db("it");

$query = "SELECT * FROM users";
$data = mysql_query($query) or die ('Error displaying data');

while($info = mysql_fetch_array($data))
{
print "Id:" .$info['User_id'] . " ";
print "Name:" .$info['User_name']. " ";
print "Password:" .$info['User_password']. "
";

}

No comments: