Instead of:
<?php
$dbConn = mysql_connect('127.0.0.1', 'root', 'thepassword') or die('Could not connect: ' . mysql_error());
echo "HURRAY! mysql_connect works!<br>"; // this line never gets displayed on the page
if (!$dbConn)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("mydb", $dbConn);
$sql="SELECT * FROM levels";
..
Try:
[PHP]
mysql_connect("127.0.0.1", "root", "thepassword") or die('Could not connect to MySQL: ' . mysql_error());
echo "Connected to MySQL<br />";
mysql_select_db("mydb") or die('Could not connect to Database: ' . mysql_error());
echo "Connected to Database";
$result = mysql_query("SELECT * FROM levels") or die('Could not connect to Table: ' . mysql_error());
[/PHP]
You were dying twice for some reason (line 3 and 9 or your code) and even though it might work, I am not familiar with the way you wrote it with regards to how you use mysql_select_db and a few others. Then again, I am very new, so maybe everything I have said is a waste of time. If so, let me know and I will shut up!