₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,957 members, 8,424,324 topics. Date: Thursday, 11 June 2026 at 02:12 AM

Toggle theme

Pragneshpj's Posts

Nairaland ForumPragneshpj's ProfilePragneshpj's Posts

1 (of 1 pages)

LiteratureRe: Mysterious Ileya Ram by pragneshpj: 2:07pm On Sep 12, 2016
olatex25:
hmm.... Ransome.... Hmm...

hmm.... Ransome.... Hmm...

hmm.... Ransome.... Hmm...
ProgrammingSimple Pagination In PHP by pragneshpj(op): 9:55am On Aug 24, 2016
<?php
$num_rec_per_page=10;
mysql_connect('localhost','root','');
mysql_select_db('apex1');
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $num_rec_per_page;
$sql = "SELECT * FROM student LIMIT $start_from, $num_rec_per_page";
$rs_result = mysql_query ($sql); //run the query
?>
<table>
<tr><td>Name</td><td>Phone</td></tr>
<?php
while ($row = mysql_fetch_assoc($rs_result)) {
?>
<tr>
<td><?php echo $row['Name']; ?></td>
<td><?php echo $row['Phone']; ?></td>
</tr>
<?php
};
?>
</table>
<?php
$sql = "SELECT * FROM student";
$rs_result = mysql_query($sql); //run the query
$total_records = mysql_num_rows($rs_result); //count number of records
$total_pages = ceil($total_records / $num_rec_per_page);

echo "<a href='pagination.php?page=1'>".'|<'."</a> "; // Goto 1st page

for ($i=1; $i<=$total_pages; $i++) {
echo "<a href='pagination.php?page=".$i."'>".$i."</a> ";
};
echo "<a href='pagination.php?page=$total_pages'>".'>|'."</a> "; // Goto last page
?>
Nairaland GeneralFirst Post To Nairaland by pragneshpj(op): 5:12am On Aug 16, 2016
This is my first post to nairaland..

1 (of 1 pages)