i am writing code of pagination & i got an error. this is my code :
<?php
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("Admin") or die(mysql_error());
if (isset($_GET["page"]))
{
$page = $_GET["page"];
}
else
{
$page=1;
}
$start_from = ($page-1) * 2;
$sql = "SELECT * FROM events ORDER BY event ASC LIMIT $start_from, 2";
$result = mysql_query ($sql) or die(mysql_error());
$num=mysql_numrows($result);
$x=0;
?>
<table>
<tr><td>Event</td><td>Types</td></tr>
<?php
while ($x<$num) {
$row1 = mysql_result($result,$x,'event');
$row2 = mysql_result($result,$x,'types');
?>
<tr>
<td><? echo $row1; ?></td>
<td><? echo $row2; ?></td>
</tr>
<?php
$x++;
}
?>
</table>
<?php
$sql = "SELECT COUNT(event) FROM events";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_row($result);
$total_records = $row[0];
$total_pages = ceil($total_records / 2);
for ($i=1; $i<=$total_pages; $i++) {
echo "<a href='pagination.php?page=".$i."'>".$i."</a> ";
}
?>
now i got an error.
object not found