MySQL Forums
Forum List  »  Newbie

Re: Internal server error - table too big?
Posted by: Alan Rolfe
Date: May 13, 2012 01:55PM

Rick

Thanks for your interest.

I'm not sure how to access the error log, but I've emailed my server contact to ask.

I'm not checking for errors after every call, but I do after the mysql_connect. Where would be the best place to send the errors and how would I do this?

The full text of the module is listed below. Note that there are three nested loops here:
-------------------------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">;
<html xmlns="http://www.w3.org/1999/xhtml"; lang="en-gb" xml:lang=
"en-gb">
<head>
<!-- Updated 11th May 2012 -->
<meta http-equiv="Content-Type" content=
"text/html; charset=us-ascii" />
<title>
Display stats under Leaders
</title>
<link href="../sbc_styles.css" rel="stylesheet" type=
"text/css" />
<link href="../spry/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<style type="text/css">


</style>
</head>
<body>
<div id="column_wrapper">
<div id="header">
<img alt="sbc_logo (9K)" src="../sbc_logo.png" height="95" width="100" />
<img alt="Slough Baptist Church" src="../images/logo_words.png" height="79" width="458" />
</div> <!-- end of header -->

<div id="navigation">
<ul id="MenuBar" class="MenuBarHorizontal">
<li id="home"><a href="../index.php">BACK TO MAIN SITE</a>
</ul>

</div> <!-- end of navigation -->
<div id="downabit">
<p> <a href="statswitch.html">Go back to stats switchboard</a> </p>
<h1>Display song usage against leader</h1>
<table>
<?php
$con = mysql_connect("","matwebhc","*********");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("matwebhc");

echo "<tr><th>Song</th><th>am</th><th>pm</th><th>Total</th></tr>";
// For each leader
$result3 = mysql_query("SELECT * FROM leaders ORDER BY leadername");
while($row3 = mysql_fetch_array($result3))
{
$ldrID=$row3['leaderID']; //Leader ID
$ldrname=$row3['leadername']; //Leader name
// Check if this leader has been used
$result4 = mysql_query("SELECT leader FROM service");
$lused=0; // indicates not used
while ($row4 = mysql_fetch_array($result4))
{
if ($ldrID==$row4['leader'])
$lused=1; // indicates used
}
// Skip the rest if leader not used
if ($lused==1)
{
echo "<tr><td colspan=4><h3>" . $ldrname . "</h3></td></tr>";
// Go through songs one-by-one
$result1 = mysql_query("SELECT ID, Title FROM songtab ORDER BY Title");
while($row1 = mysql_fetch_array($result1))
{
$songcountpm=0;
$songcountam=0; //Reset song counters
$currentsong=$row1['ID']; // Note current song ID
//Look at each service
$result2 = mysql_query("SELECT * FROM service");
// Error here. There appears to be too much data, as reducing the number of entries in the 'service' table or the number of fields solves the problem
while ($row2 = mysql_fetch_array($result2))
{
if ($ldrID==$row2['leader'])
{
if ($currentsong==$row2['song1'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song2'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song3'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song4'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song5'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song6'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song7'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song8'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song9'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song10'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song11'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song12'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song13'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song14'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song15'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song16'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song17'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song18'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song19'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
if ($currentsong==$row2['song20'])
{
if ($row2['ampm']==1)
$songcountam++;
else
$songcountpm++;
}
} //end of leader 'if' statement

} //end of 'while' (result2)

$songcount=$songcountam+$songcountpm;
if ($songcount!=0)
{

echo "<tr><td>" . $row1['Title'] . "</td><td>" . $songcountam . "</td><td>" . $songcountpm . "</td><td>" . $songcount . "</td></tr>";
} // Only output if song was used


} // end of 'while' (result1)
} //end of 'if' (test for used leader)
} // end of 'while' (result3)
?>
</table>
</div> <!-- end of downabit -->
</div> <!-- end of column_wrapper -->
</body>
</html>

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.