Hi, I’ve been using this huge code for years to create list pages… with alternating cell backgrounds for multiple entries. I know i’m not calling the data properly in this sample, but the meat is really in the script anyways.
What are your thoughts, is there something lighter than this to count entries, and display them in a list?
[code=php]$sql = “SELECT COUNT(*) FROM it_issues WHERE Issue_Closed = ‘0’”;
$numrecord = mysql_query($sql);
$numrecords = mysql_fetch_array($numrecord);
$intRecsPerPage=100;
if($_POST[“intpage”]==””)
{
$intpage=1;
}
$sql = “SELECT * FROM it_issues WHERE Issue_Closed = ‘0’ ORDER BY Issue_LastEdit DESC LIMIT “.(($intpage-1)*$intRecsPerPage).”, “.$intRecsPerPage;
$result = mysql_query($sql) or die (mysql_error());
$totalpages = intval(($numrecords[0])/$intRecsPerPage);
if(intval($numrecords[0]/$intRecsPerPage) != ($numrecords[0]/$intRecsPerPage))
{
$totalpages = $totalpages + 1;
}
for($x = (($intpage-1) * $intRecsPerPage); $x < (($intpage-1) * $intRecsPerPage) + $intRecsPerPage; $x++)
{
if($x/2 != intval($x/2))
{
$bgcolor = “#ffffff”;
}
else
{
$bgcolor = “#F7F7F7”;
}
if($x >= $numrecords[0])
{
break;
}
$issueresults = mysql_fetch_array($result);
//BEGIN LOOP
<tr><td bgcolor=$bgcolor>sample</td></tr>
//END LOOP
}