PHP script giving 500 internal server error?

JTEwv

New member
This code produces no PHP fatal errors or warnings, but gives us an Apache 500 Internal Server error.
Why? I commented out pretty much the entire loop. If I comment out the first while too, it doesn't give a server error. But just with the while statement (and technically nothing happening inside it), it freaks out. What's goin on?


<?php
// Connects to your Database
require("libraries/db/dbconnect.php");
// Encrypt Page
require("libraries/auth/membersarea.php");

$username = $_COOKIE['ID_my_site'];
$userID = mysql_result(mysql_query("select ID from users where username = '$username'"), 0);

$result = mysql_query("SELECT * FROM payroll ORDER BY PID DESC");

if (!$result) {
echo "Could not successfully run query from DB: " . mysql_error();
exit;
}
if (mysql_num_rows($result) == 0) {
echo "No past payments available";
exit;
}

// New code by Josh
// Gonna annotate this like a boss to keep track

// Open our table up
echo "<table align=\"center\" width=\"400\">\r\n";

while($row = mysql_fetch_array(mysql_query("SELECT * FROM payroll ORDER BY PID DESC")))
{
// Table is opened. Let's bring in our Timestamp:
//echo "<tr><td>Timestamp</td><td>".$row2['timestamp']."</td><td><i>N/A</i></td></tr>";
// Configure the columns of the table
//echo "<tr><td></td><td><strong>Unit</strong></td><td><strong>Rate</strong></td></tr>\r\n";
// Bring in our variables now
/*while($row2 = mysql_fetch_array(mysql_query("SELECT * FROM vars ORDER BY ID ASC")))
{
// Determine variables
$aliasName = $row2['varAlias'];
$aliasRate = $row2['varAlias']."_rate";
// Parse into table
echo "<tr><td>".$aliasName."</td><td>".$row[$aliasName]."</td><td>".$row[$aliasRate]."</td></tr>\r\n";
}*/
}

echo "</table>\r\n";
// End table


// Footer Template
require("template/footer.php");
?>
 
Back
Top