Sorry if I am being dumb here, but I just cant seem to grasp the concept.. I thought what you typed looked straightforward enough..
but.. after trying to get it to work in my code, well it all goes a bit pear shaped.
Here is the code I've tried.. and Ive tried several variations..
// ***** end of map editing
else {
// WHAT MAPS HAVE WE GOT?
// ***** show map list
if (!empty($offset)) {
$offsetstring = "OFFSET " . $offset;
}
else {
$offsetstring = "";
}
$result = mysql_query("SELECT * FROM ccentral_maps ORDER BY MAP LIMIT 20" . $offsetstring,$db);
if ($myrow = mysql_fetch_array($result)) { //<--- IS LINE 214 (SEE BELOW)
echo "<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\">\n";
echo "<tr><td colspan=\"3\"><center><strong>Maps - Admin</strong></center></td>\n";
do {
printf("<tr><td><a href=javascript:openWindow(\"../maps/maps.php?id=%s&detail=1\")>%s</a><br>\n</td>", $myrow["id"], $myrow["MAP"]);
printf("<td><center><a href=\"%s?id=%s&edit=1\">EDIT</a></center></td>\n", $PHP_SELF, $myrow["id"]);
printf("<td><center><a href=\"%s?id=%s&verify=1\">DELETE</a></center></td></tr>\n", $PHP_SELF, $myrow["id"]);
} while ($myrow = mysql_fetch_array($result));
echo "</table>\n";
$nextoffset=$offset + 20;
$prevoffset=$offset - 20;
print "<A HREF=$PHP_SELF?&offset=$prevoffset>previous</a>";
print "<A HREF=$PHP_SELF?offset=$nextoffset>next</a>";
echo "<br><br><center><table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\">\n";
printf("<tr><td><center><strong><a href=\"%s?addmap=1\">Add A New Map!</a></strong></td></tr></table></center>\n", $PHP_SELF);
}
else {
// ***** no records to display
echo "<center><table width=\"50%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\">\n";
echo "<tr><td><center><strong>Sorry, no map records were found!</strong></td></tr></table></center>";
echo "<br><br><center><table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\">\n";
printf("<tr><td><center><strong><a href=\"%s?addmap=1\">Add A New Map!</a></strong></td></tr></table></center>\n", $PHP_SELF);
}
}
?>
All that happens is.. yes initially on loading the page 20 results are printed, and both links are printed also..
However if I click on either of them I get a:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in g:\easyphp\www\clan_central\admin\maps_admin.php on line 214 and the page reverts to the "Sorry, no map records found" which comes after the final else {}.
Sorry but its now 6.15am, and my brain is turning to mush.. so please bare with me, while I try and make sense of this!
Thanks,
Lee