Page 1 of 1

Blank page?

Posted: Fri May 14, 2010 2:23 pm
by mlummus
When viewing this program in a browser, I'm getting nothing - no html, no php, no source whatsoever - just white. The page is coming up blank. Any idea why?

Code: Select all

<html>
<head>
<title> Student Delete </title>
</head>
<body>
<h1>Student Delete Form </h1>
<h2>Select a Student</h2>

<?php
$db = mysqli_connect("dbserver.com", "user", "password");
if (!db) {echo "Error: Could not connect to database."; 
exit;}
mysqli_select_db("dbname");

$query = "SELECT id from student";
$result = mysqli_query($query);
$num_results = mysqli_num_rows($result);

echo "<p> Number of students found: ".$num_results."</p>";
echo "<form method='post' action='studentfind.php'>";
echo "ID:" <select name = 'id'>";

for ($i=0; $i < $num_results; $i++)
{
$row=mysqli_fetch_array($result);
$id = $row["id"];
echo "<option value = "$id"> $id </option>";
}

echo "<input type='submit' value='delete' />";
echo "</form>";

mysqli_close("$db");
?>

</body>
</html>

Re: Blank page?

Posted: Fri May 14, 2010 2:26 pm
by requinix
Blank pages typically mean syntax errors and hidden error messages. Open up your php.ini and set error_reporting=E_ALL and set display_errors=on - that will let you see PHP's parse errors.

Since your script is so small you can just look at it for a syntax error. See how the highlighting is unusual towards the end? That's a hint as to where the problem is.