这里我写了查询以显示3行数据,它从mysql数据库中获取数据。它显示“1,2,3”按钮。当我按下2按钮时,它不会进入下一页。我认为我的SQL查询不正确..请帮助我。
<?php
$connection = mysql_connect("localhost","root","");
$gender1=$_POST['gender'];
if (!$connection) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("nursingcarein",$connection);
$city=$_POST['city'];
$gender=$_POST['gender'];
$profession=$_POST['profession'];
$state=$_POST['state'];
if (isset($_GET["page"])) {
$page = $_GET["page"];
} else {
$page=1;
};
$start_from = ($page-1) * 3;
/*HERE IN WHERE IT MATCHES THE GIVEN "GENDER" in the textbox*/
$sql = "SELECT age,description,name FROM nursereg WHERE gender='$gender' LIMIT
$start_from, 3";
$rs_result = mysql_query ($sql,$connection);
?>
<table>
<tr>
<td>Image</td>
<td>Description</td>
</tr>
<?php
while($row=mysql_fetch_array($rs_result)) {
?>
<tr>
<td><? echo $row['name']; ?></td>
<td><? echo $row['age']; ?></td>
<td><? echo $row['description']; ?></td>
</tr>
<?php
};
?>
</table>
<?php
$sql = "SELECT COUNT(Name) FROM nursereg";
$rs_result = mysql_query($sql,$connection);
$row = mysql_fetch_row($rs_result);
$total_records = $row[0];
$total_pages = ceil($total_records / 5);
for ($i=1; $i<=$total_pages; $i++) {
echo "<a href='ind1.php?page=".$i."'>".$i."</a> ";
};
?>