I've the following code
<?php
mysql_connect (localhost, ******, *******);
mysql_select_db (*******);
$startdate='2003-01-01';
$enddate='2003-01-31';
$limit=20;
$numresults=mysql_query("SELECT * FROM opleiding WHERE start >='$startdate' AND start <='$enddate' ORDER by start");
$numrows=mysql_num_rows($numresults);
if (empty($offset)) {
$offset=1;
}
$result=mysql_query("SELECT * FROM opleiding WHERE start >='$startdate' AND start <='$enddate' ORDER by start limit $offset,$limit");
while ($row = mysql_fetch_array($result)) {
print $row["cursus"];
print (" ");
list($year, $month, $day) = explode("-", $row["start"]);
echo $day;
print ("/");
echo $month;
print ("/");
echo $year;
print (" ");
print ("<a href=\"http://www.cmo-mechelen.be/detail.php?id=$row[id]\">");
print ("klik hier");
print ("</a>");
print ("<br>");
}
if ($offset==1) { // bypass PREV link if offset is 0
$prevoffset=$offset-20;
print "<a href=\"$PHP_SELF?offset=$prevoffset\">PREV</a> \n";
}
if ($numrows%$limit) {
$pages++;
}
for ($i=1;$i<=$pages;$i++) { // loop thru
$newoffset=$limit*($i-1);
print "<a href=\"$PHP_SELF?offset=$newoffset\">$i</a> \n";
}
if (!(($offset/$limit)==$pages) && $pages!=1) {
$newoffset=$offset+$limit;
print "<a href=\"$PHP_SELF?offset=$newoffset\">NEXT</a><p>\n";
}
?>
The script works, the next/prev links not and I can't figure out why
I also tried this
$startdate=getdate();
$enddate=("getdate()+30;
but it doesn't work (no records displyed)
when I fill out the dates myself, I get the correct records
strange
any help will be greatly appreciated