Urgent help with mysql data not displaying using PHP, please
Posted: Mon Feb 22, 2010 10:50 pm
Hey guys, so I have a database called b9_3095165_mmdb with a table called Persons
and it has two entries for FirstName and LastName
I am simply trying to output this to the web browser using this PHP code and all I get is a blank page but no mysql records shown.
Here is the codel
Can someone tell me what It is not displyaing the data in the mysql table.
and it has two entries for FirstName and LastName
I am simply trying to output this to the web browser using this PHP code and all I get is a blank page but no mysql records shown.
Here is the codel
Code: Select all
<?php
$username = "b9_3095165";
$password = "REMOVED";
$hostname = "REMOVED";
$dbh = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
$selected = mysql_select_db("b9_3095165_mmdb",$dbh)
or die("Could not select first_test");
$result = mysql_query("SELECT FirstName, LastName FROM Persons");
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
print " Name:".$row{'FirstName'}." ;
}
mysql_close($dbh);
?>