Mysql.. 500 server error?

software development

#1

I keep getting a 500 server error when running this bit of mysql/php code. all my other code is working extremely fast, but this query group seems to time out my server…

error Log:
[Mon Oct 30 10:30:00 2006] [error] [client my ip] Premature end of script headers: php5.cgi, referer: http://temp.gen-anime.com/index.php?page=user&m_id=1

The Code:
function writeBlogComments($entry,$min=0,$max=-1)
{
global $BLOG_COM_PER_PAGE;
if($max==-1)
{
$max = $BLOG_COM_PER_PAGE;
}
$sql = “SELECT * FROM blogs WHERE id=’$entry’”;
$result = mysql_query($sql) or ($error=true);
if(!$error)
{
$blog = mysql_fetch_assoc($result);
echo("

");
echo("".getNameById($blog[‘owner_id’],true)."
".getAvatarById($blog[‘owner_id’])."
");
echo("".databaseToDate($blog[‘date’])."

".$blog[‘title’]."

");
echo("
".$blog[‘entry’]."
");
echo("
");
mysql_free_result($result);
//start the accual comments
$alt_sql = “SELECT * FROM blog_comments WHERE blog=’$entry’ LIMIT $max OFFSET $min”;
$alt_result = mysql_query($alt_sql) or ($error=true);
if(!$error)
{
if(mysql_num_rows($alt_result) != 0)
{
while($row = mysql_fetch_assoc($alt_result))
{ // the above line is where it seems to hang up on!
echo("
".getAvatarById($row[‘owner_id’])."
“.$row[‘title’].”

by “.getNameById($row[‘owner_id’],true).” on “.databaseToDate($row[‘date’]).”
");
echo($row[‘comment’]."
");
}
mysql_free_result($alt_result);
} else {
echo(“No Comments”);
}
} else {
echo(“Error in comment getter”);
}
} else {
echo(“UNPOSSABLE!”);
}
}

-if your not afraid… your not paying close enough attention -fmkaiba - fuhrer and flame alchemist


#2

Problem solved, a previous function had global-ed a variable i am using. thanks anyway

-if your not afraid… your not paying close enough attention -fmkaiba - fuhrer and flame alchemist