Ok, so I created a test database on my server, created 1 table with 1 row in it and the row is populated with values. I can connect to the database without error, but when I try to put in a while loop to print the results I get nothing but a blank screen. I tried placing some debug code in the while loop to see where its getting hung up but the while loop doesn't want to run at all. I placed an echo directly outside of the loop and the debug text is displayed fine but anything I put in the loop doesn't work. Can anyone help me out? Here is my code:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
<?php
$dbuser = "webestat_testdb";
$dbpass = "password";
$dbname = "webestat_testdb";
$server = "localhost";
$conn = mysql_connect($server, $dbuser, $dbpass);
if (!$conn)
{
echo "Failed to connect to db" . mysql_error();
}
$selectdb = mysql_select_db('webestat_testdb', $conn);
$sql = "SELECT * FROM 4000Series";
$results = mysql_query($conn, $sql);
while($row = mysql_fetch_assoc($results))
{
echo "test";
echo $row['gpu']. " " .$row['khs']. " " .$row['usd'];
echo "<br>";
}
mysql_close($conn);
?>
</body>
</html>