Forum Moderators: coopster
<?php
$user="red";
$pw="red";
$table=$subcategory;
$mysql_access = mysql_connect("localhost", $user, $pw);
$result=mysql_select_db($dbname, $mysql_access);
if ( isset($locationcountry) && $locationcountry!= "" )
{
$where_query .= empty($locationcountry)? " WHERE " : " AND ";
$where_query .= " locationcountry LIKE '%" . $locationcountry . "%'";
}
$page = $_GET["page"];
if (($page<0) ¦¦ ($page=="")) $page=0;
$epp = 1; /* entries per page */
$l1 = $epp*($page);
$l2 = $epp;
$result = MYSQL_QUERY( "SELECT * FROM $table".$where_query." ORDER BY date LIMIT $l1, $l2 ");
$xcount=0;
while($row = mysql_fetch_row($result)){
$xcount=$xcount+1;
print($row[0]);
}
?>
btw, you can also use
$xcount++;
which is the same as $xcount=$xcount+1;
dc
If ...
Have you tried printing out $l1 and $l2? That will probably show you the problem straight away (maybe you are accidentally setting $l1 and $l2 to the same value?)
if (empty($_GET['page']))
this handles the cases where
$_GET['page'] = 0
$_GET['page'] = ""
$_GET['page'] = is not set at all and error reporting is set to E_ALL
It would not, of course, handle negative numbers, but unless you're using negative nubmers for error reporting, there shouldn't be any (there's no page -1 presumably)