Good evening! i'm currently trying to run this PHP code on my site. the intended thing is that it reads from a phpMyAdmin database, and I can't even tell atm if it has connected properly or not. how can i fix this to get a result other than a blank screen?
<html>
<head>
<title>Query All Games from Database</title>
<body>
<?
@ $db = mysql_pconnect("HOSTNAME","USERNAME","PASSWORD"); //actual details of this omitted for obvious reasons.
if (!$db)
{
echo "ERROR: Could not connect to database. Please try again later.";
exit;
}
mysql_select_db("DATABASENAME");
$query = "select * from titles";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
echo "<p>Number of games found: ".$num_results."</p>";
for ($i=0; $i < $num_results; $i++)
{
$row = mysql_fetch_array($result);
echo "<p>";
echo htmlspecialchars( stripslashes($row["gameid"]));
echo "<br>";
echo htmlspecialchars( stripslashes($row["gametitle"]));
echo "<br>";
echo htmlspecialchars( stripslashes($row["console"]));
echo "<br>";
echo htmlspecialchars( stripslashes($row["comments"]));
echo "<br>";
echo "</p>";
}
?>
</body>
</html>
<html>
<head>
<title>Query All Games from Database</title>
<body>
<?
@ $db = mysql_pconnect("HOSTNAME","USERNAME","PASSWORD"); //actual details of this omitted for obvious reasons.
if (!$db)
{
echo "ERROR: Could not connect to database. Please try again later.";
exit;
}
mysql_select_db("DATABASENAME");
$query = "select * from titles";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
echo "<p>Number of games found: ".$num_results."</p>";
for ($i=0; $i < $num_results; $i++)
{
$row = mysql_fetch_array($result);
echo "<p>";
echo htmlspecialchars( stripslashes($row["gameid"]));
echo "<br>";
echo htmlspecialchars( stripslashes($row["gametitle"]));
echo "<br>";
echo htmlspecialchars( stripslashes($row["console"]));
echo "<br>";
echo htmlspecialchars( stripslashes($row["comments"]));
echo "<br>";
echo "</p>";
}
?>
</body>
</html>