PDA

View Full Version : Reading from mySQL


hansenquao
05-28-2006, 04:21 PM
Hi,
I am very new at PHP. I am designing this portal that requires users to input their names, email and mobile phone numbers. My database is mySQL and i am running xampp as my local webserver.

I have managed to get the the form to store the input details into the dbase. How can i create a page that allows the admin person to read all the sign ups in the dbase?

Thanx mates

harsh789
05-28-2006, 04:49 PM
$username="un";
$password="pd";
$database="your_db";

mysql_connect('localhost',$username,$password);
mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM users";
$result=mysql_query($query);

while($ro=mysql_fetch_array($result))
{
$name = $ro['name'];
$email = $ro['email'];
$mobile_phone = $ro['mobile_phone'];
echo "<b>Name:</b>$name<br>";
echo "<b>Email:</b>$email<br>";
echo "<b>Mobile phone :</b>$mobile_phone<br>";
}
mysql_free_result($result);