[liphp] Next Page Help

Alexander (Sasha) Mejenkov [email protected]
Sat, 18 Oct 2003 15:48:54 +0400


Hello Troy,

There is a "LIMIT" condition in a query. See lines
/*==Append the limit and offset to the sql==*/
$sql3.=" Limit $thisOffset,$recordLimit";

Seems that links don't work properly because of wrong using of
PHP_SELF. There is no $PHP_SELF variable. There is
$_SERVER['PHP_SELF'] variable

Here is excerpt from PHP docs

=====================
Predefined Variables
Server variables: $_SERVER
Note: Introduced in 4.1.0. In earlier versions, use $HTTP_SERVER_VARS. 

'PHP_SELF'
The filename of the currently executing script, relative to the
document root. For instance, $_SERVER['PHP_SELF'] in a script at the
address http://example.com/test.php/foo.bar would be
/test.php/foo.bar.
=====================

So your code should look like
$page_count .=  "'; return true\" onmouseout=\"window.status=''\""."href=\"$_SERVER[PHP_SELF]?cat_id=$_SESSION[cat_id]&thisOffset=$nextOffset&lineIndex=$nextOffset\">$i</a>&nbsp;";

Note that when you use $_SERVER[PHP_SELF] inside quoted string like
echo "$_SERVER[PHP_SELF]";
you don't need to use single quotes around PHP_SELF

You have to use them when your syntax is as following
echo "This is currently executing script " . $_SERVER['PHP_SELF'];

I had no time to look your script in more details. So hope this was
the only bug.

Hope this helps.

Sasha