I am having some issues with Paging. Not sure why I'm getting the error but I am tired and can't concentrate long. The error is:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in
From my limited experience I'm guessing that something is wrong with the query itself but I can't figure it out. Here is the code:
<?
include("dbinfo.inc.php");
include("header.inc");
//how many rows to show per page
$rowsPerPage = 5;
//show first page by default
$pageNum = 1;
// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
mysql_connect("$hostname",$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query= "SELECT * FROM scores order by ID DESC"."LIMIT $offset, $rowsPerPage";
$result=mysql_query($query);
//print the pages
while($row = mysql_fetch_array($result))
{
echo $row['user'] . ' bowled a' . $row['score'] . ' on ' . $row['date'] . '<br>';
}
?>