Hi,
Cheers for that but I can't seem to get it to return any resukts. I put my while loop into the section you said put display stuff here.
At first I was getting a parse error but noticed there was a close parenthesis missing. Ive included the full code here please have a look.
Andy
<?
$limit = 2;
$link_id = db_connect("b34t");
$query = "select date_format(date, '%M %D %Y'), title, artist, review, label from reviews order by id asc limit $limit";
$result = mysql_query($query);
$nrows = count($result);
$numpages=ceil($nrows/$limit);
$from = $offset;
if ($nrows <= $offset+$limit)
{
$to = $nrows-1;
}
else
{
$to = $offset+$limit-1;
}
foreach (range($from, $to) as $rownum)
{
$row = $result[$rownum];
if (!empty($row))
{
while($myrow = mysql_fetch_row($result))
{
$myrow[4] = nl2br($myrow[4]);
echo"<font face=\"verdana\" size=\"1\">
<b>Date:</b> $myrow[0]<br>
<b>Title:</b> $myrow[1]<br>
<b>Artist:</b> $myrow[2]<br>
<b>Label:</b> $myrow[4]<br>
<b>Review:</b> $myrow[3]<br><br></font>";
}
}
}
if ($numpages > 1)
{
$pagebits = "Page: ";
for ($i=0;$i<$numpages;$i++)
{
$newoffset=$limit*($i);
$pg = $i + 1;
if ($page == $pg)
{
$pagebits .= "$pg ";
}
else
{
$pagebits .= "<a href=\"$PHP_SELF?action=results&offset=$newoffset&limit=$limit&page=$pg\">$pg</a> ";
}
}
}
if ($offset>1)
{
$prevoffset = $offset - $limit;
$prevpage = $page - 1;
$previous = "<a href=\"$PHP_SELF?action=results&offset=$prevoffset&limit=$limit&page=$prevpage\">Previous $limit records</a> ";
}
else
{
$previous = " ";
}
if ($nrows>($offset+$limit))
{
$nextoffset = $offset + $limit;
$nextpage = $page + 1;
$next = "<a href=\"$PHP_SELF?action=results&offset=$nextoffset&limit=$limit&page=$nextpage\">Next $limit records</a>";
}
else
{
$next = " ";
}
?>