I need help in getting the items per page.
here's the code:
My problem here really is this line:
thanks in advance.
here's the code:
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_karerabet"));
$num_items = $noi[0]; //changable
$items_per_page= 10;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
//changable sql
$sql = " SELECT uid, COUNT(*) as nopl, combination, COUNT(*) as notl FROM ibwf_karerabet GROUP BY uid, combination ORDER BY time DESC LIMIT $limit_start, $items_per_page";
$cou = $limit_start;
echo "<p>";
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
$cou++;
$unick = getnick_uid($item[0]);
$nm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_karerabet WHERE uid='".$item[0]."' AND combination='".$item[2]."'"));
$lnk = "$cou. $unick: <b>$item[2]</b> ($nm[0])";
echo "$lnk<br/>";
}
}
$num_items = $noi[0]; //changable
$items_per_page= 10;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
//changable sql
$sql = " SELECT uid, COUNT(*) as nopl, combination, COUNT(*) as notl FROM ibwf_karerabet GROUP BY uid, combination ORDER BY time DESC LIMIT $limit_start, $items_per_page";
$cou = $limit_start;
echo "<p>";
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
$cou++;
$unick = getnick_uid($item[0]);
$nm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_karerabet WHERE uid='".$item[0]."' AND combination='".$item[2]."'"));
$lnk = "$cou. $unick: <b>$item[2]</b> ($nm[0])";
echo "$lnk<br/>";
}
}
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_karerabet"));
Comment