$page_name= (isset($_POST['page_name']));
@$limit=$_GET['limit'];
if(strlen($limit) > 0 and !is_numeric($limit)){
echo "Data Error";
exit;
}
switch($limit)
{
case 2:
$select2="selected";
$select10="";
$select5="";
break;
case 5:
$select5="selected";
$select10="";
$select2="";
break;
default:
$select10="selected";
$select5="";
$select2="";
break;
}
$start=($_GET['start']); // THIS PART!//
if(strlen($start) > 0 and !is_numeric($start)){
echo "Data Error111";
exit;
}
$eu = ($start - 0);
if(!$limit > 0 ){
$limit = 10;
}
$this1 = $eu + $limit;
$back = $eu - $limit;
$next = $eu + $limit;
$query=" SELECT * FROM tblename ";
$result=mysql_query($query);
echo mysql_error();
$nume=mysql_num_rows($result);
$query=" SELECT * FROM tblname limit $eu, $limit ";
$result=mysql_query($query);
echo mysql_error();
<?php while($row_Recordset1 = mysql_fetch_array($result)) { ?>
<tr>
<td><?php echo $row_Recordset1['Id']; ?></td>
<td><?php echo $row_Recordset1['country']; ?></td>
<?php
if($back >=0) {
print "<a href='$page_name?start=$back&limit=$limit'><font face='Verdana' size='2'>PREV</font></a>";
}
echo "</td><td align=center width='30%'>";
$i=0;
$l=1;
for($i=0;$i < $nume;$i=$i+$limit){
if($i <> $eu){
echo " <a href='$page_name?start=$i&limit=$limit'><font face='Verdana' size='2'>$l</font></a> ";
}
else {
echo "<font face='Verdana' size='4' color=red>$l</font>";
}
$l=$l+1;
}
echo "</td><td align='right' width='30%'>";
if($this1 < $nume) {
print "<a href='$page_name?start=$next&limit=$limit'><font face='Verdana' size='2'>NEXT</font></a>";
}
echo "</td></tr></table>";
?>
答案 0 :(得分:0)
替换
$start=($_GET['start']);
到
$start=1;//some default value
if(isset($_GET['start']))
$start=$_GET['start'];