注意:未定义的索引:第4行的C:\ xampp \ htdocs \ myPage.php中的页面

时间:2014-10-15 05:25:35

标签: php

我试图为分页创建一个简单的页面,但得到以下错误。任何人都可以帮助我。我相信错误在“$ page = $ _ GET [”page“];”。

注意:未定义的索引:第4行的C:\ xampp \ htdocs \ myPage.php中的页面

<?php 
include('connection.php');

$page=$_GET["page"];
if($page=="" || $page=="1")
{
$page1=0;
}
else
{
$page1=($page*2)-2;
}


$res=mysql_query("select * from test limit $page1,2");

echo "<table border='1'>
<tr>
<th>ID</th>
<th>Date</th>
</tr>";

while($row=mysql_fetch_array($res))
{
echo "<tr>";
  echo "<td>" . $row['id'] . "</td>";
  echo "<td>" . $row['Date'] . "</td>";

  echo "</tr>";
  }
echo"</table>";

$res1=mysql_query("select * from test");
$cou=mysql_num_rows($res1);

$a=$cou/2;
$a=ceil($a);
echo"<br>";echo"<br>";
for($b=1;$b<=$a;$b++)
{
?><a href="myPage.php?page=<?php echo $b;?>" style="text-decoration:none"><?php echo $b." ";?></a> <?php
}

?>

0 个答案:

没有答案