View Single Post
Old June 28th, 2005, 12:28 PM
club662 club662 is offline
Authorized User
Join Date: Jun 2005
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts

i had the same problem,
the problem is that the $offset variable does not get initialised until you define it in the url (localhost/page.php?offset=n).

When you just go to localhost/page.php
the mysql query will look like this:
"SELECT movie_name, movie_year " .
"FROM movie " .
"ORDER BY movie_name " .
"LIMIT ,1"

whilst mysql expects a "LIMIT n,x"

So you have to set a value for offset ONLY when it has no value yet.
As this is not yet explained at that point, this is the answer:

Instead of
$offset = $_REQUEST['offset']
you have to do this

//make sure a value is assigned to $offset if it not yet exists.
if ($_REQUEST['offset'] == NULL
//just to double check
echo $offset;