pagination
-
hi friends
in my worpress site . i was tried to put the pagination but succussfully i was run the code . but if i move to 2 page it showing first 10 result . not showing another 10 result. pls help me to solve this issue
-
have you read https://codex.wordpress.org/Pagination ?
what codes have you used?
are you using a custom query and loop?
hi Friend thanks for your reply my php code is
<?php
$num_rec_per_page=2;
mysql_connect(‘localhost’,’root’,”);
mysql_select_db(‘dbtuts’);
if (isset($_GET[“page”])) { $page = $_GET[“page”]; } else { $page=1; };
$start_from = ($page-1) * $num_rec_per_page;
$sql = “SELECT * FROM tbl_uploads_new 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 tbl_uploads_new”;
$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 ““.’|<‘.” “; // Goto 1st page
for ($i=1; $i<=$total_pages; $i++) {
echo ““.$i.” “;
};
echo ““.’>|’.” “; // Goto last page
?>when i put into the local its working showing correctly .but when i try to put into the live site its not showing correctly [ls hepl me
When i try to host my site in live after few registeration it showing the wordpress installation page
Please make sure When you host your website on live site, you should upload database and change the site URL in the database and database credentials in the wp-config.php file.
The topic ‘pagination’ is closed to new replies.