...

View Full Version : How to call function?



che_anj
11-16-2007, 06:32 PM
hello anyone.. Ive made a pagination for my project, since all pages must have pagination, Ive decided to put into a function.. but I dont how to make it..

Ive try to make this.. it works but theres a little error..




function pagination($page,$totalrows,$pageprev,$pagenext,$lastpage){
if($page!=1)
{
$pageprev = $page - 1;
$firstpage=$page;
echo "<input type='button' class='button-expand' value=\"&lt;&lt; FIRST\" onClick='location.href=\"$PHP_SELF?click=client_list.php&menu=1&page=1$sort&euser=\"'>&nbsp;";

echo "<input type='button' class='button-expand' value=\"&lt;PREV\" onClick='location.href=\"$PHP_SELF?click=client_list.php&menu=1$sort&page=$pageprev&euser=$euser\"'>&nbsp;";

}
else if($totalrows < $limit)
{
echo '';
}
else
{
$pre=array("&lt;&lt;FIRST","&lt;PREV");
$p=0;
while($p <=1):
echo "<input type='button' class='button-expands' value=\"$pre[$p]\">&nbsp;"; $p++;
endwhile;

}
if(($totalrows - ($limit * $page)) > 0)
{
$pagenext = $page + 1;
echo "<input type='button' class='button-expand' value=\"NEXT &gt;\" onClick='location.href=\"$PHP_SELF?click=client_list.php&menu=1$sort&page=$pagenext&euser=$euser\"'>&nbsp;";

echo "<input type='button' class='button-expand' value=\"LAST &gt;&gt;\" onClick='location.href=\"$PHP_SELF?click=client_list.php&menu=1$sort&page=$lastpage&euser=$euser\"'>";

}
else if($totalrows < $limit)
{
echo '';
}
else
{
$pre=array("NEXT&gt;","LAST&gt;&gt;");
$p=0;
while($p <=1):
echo "<input type='button' class='button-expands' value=\"$pre[$p]\">&nbsp;";
$p++;
endwhile;
}
}


if the page = lastpage the must class of the button must equal to class='button-expands' but it does not work at all..

ConnorMHB
11-17-2007, 12:16 AM
what's the error?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum