I cannot get the result for this one. But the ouput is like this:
Name 01 02 03 04 05 06 07 08 09 10 1 [URL=“http://localhost/tutornetz/pagination.php?page=2”]2
any idea guys?
<?
$connection = mysql_connect("localhost", "root", "test1") or die(mysql_error());
mysql_select_db("students1") or die(mysql_error());
if (isset($_GET[“page”])) { $page = $_GET[“page”]; } else { $page=1; };
$start_from = ($page-1) * 10;
$sql = "SELECT * FROM studs1 ORDER BY name1 ASC LIMIT $start_from, 10";
$rs_result = mysql_query ($sql,$connection);
?>
<table>
<tr><td>Name</td></tr>
<?
while ($row = mysql_fetch_array($rs_result)) {
?>
<tr>
<td><? echo $row[0]; ?></td>
</tr>
<?
};
?>
</table>
<?
$sql = "SELECT name1 FROM studs1";
$rs_result = mysql_query($sql,$connection);
$row = mysql_fetch_row($rs_result);
while($row1 = mysql_fetch_array($rs_result))
{
$first = $row1[0];
}
//echo $first;
$total_records = $row1[0];
$total_pages = ceil($first / 10);
for ($i=1; $i<=$total_pages; $i++) {
echo "<a href='pagination.php?page=".$i."'>".$i."</a> ";
};
?>