The problem is that your database is titled test, but the table inside that databse is named "name".
So when you use $sql = "SELECT * FROM test"; , it's trying to find the table "test" within the database that you connected to at the top of your file. (By the way, that's not a great way to connect to a database via PHP.
//define variables
$dbhost = "localhost";
$dbuser = "andrieux";
$dbpass = "pass";
$dbdatabase = "andrieux";
//connect
$db = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($db, $dbdatabase);
You don't need error fallbacks for something as simple as connecting to localhost, so you have alot of unneeded code.
Andrieux
Junior Poster in Training
61 posts since Jan 2009
Reputation Points: 10
Solved Threads: 4