realcoder Posted July 5, 2010 Share Posted July 5, 2010 here is something wrong may be i am not getting it's only showing me 2 results on http://localhost/proj/admin/view.php and http://localhost/proj/admin/view.php?page=1 after that when i press page 2 link http://localhost/proj/admin/view.php?page=2 on this link it shows me all results from 2 to 6 it want to show result me from 4 to 6 and on 3rd page show 2 to 8 mean my $pstart is not changing what i do now ? where is m doing mistake or on simple view.php where m doing mistake someone guiade <?php include "inc.php"; $limit = 2; $que = "SELECT * FROM catg"; $exe = mysql_query($que); $num = mysql_num_rows($exe); $pages = $num/$limit ; ?> <table> <tr> <td valign="top"><?php include "menu.php"; ?></td><td> <?php $pend = $limit; $pstart = 0; if($_GET['page']) { $pstart = $limit ; $page = $_GET['page']; $pend = $limit*$page; } $que2 = "SELECT * FROM catg limit $pstart,$pend"; $exe2 = mysql_query($que2); echo "<table><tr><td>Category</td><td>Action</td></tr>"; while ($get = mysql_fetch_array($exe2)){ echo"<tr><td>".$get['cat']."</td><td><a href='delc.php?id=".$get['id']."'>delete</a> <a href='editc.php?id=".$get['id']."'>Edit</a></td></tr>"; } echo "</table>"; ?> </td> </tr><tr><td><?php for($i=1; $i<=$pages; $i++ ) echo "<a href='view.php?page=$i'>$i</a>"; ?> </td></tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/206767-page-nevigation/ Share on other sites More sharing options...
jcbones Posted July 5, 2010 Share Posted July 5, 2010 Your $pend should not change. The limit on a query is set to: LIMIT $row_start, $number_of_rows Try changing your $_GET['page'] to the $pend variable. Quote Link to comment https://forums.phpfreaks.com/topic/206767-page-nevigation/#findComment-1081378 Share on other sites More sharing options...
realcoder Posted July 6, 2010 Author Share Posted July 6, 2010 well $end is chaning but $pstart don't change & show wrong limit anybody helP Quote Link to comment https://forums.phpfreaks.com/topic/206767-page-nevigation/#findComment-1081802 Share on other sites More sharing options...
realcoder Posted July 6, 2010 Author Share Posted July 6, 2010 some one help in creating exact page nevigation please :confused: Quote Link to comment https://forums.phpfreaks.com/topic/206767-page-nevigation/#findComment-1081956 Share on other sites More sharing options...
Dragosvr92 Posted July 6, 2010 Share Posted July 6, 2010 just so you know.. only YOU Can see this page http://localhost/proj/admin/view.php if you want others to access it and look at it you need to replace the LocalHost with your IP Address you can see your IP in the right side of your posts or By Clicking Here Quote Link to comment https://forums.phpfreaks.com/topic/206767-page-nevigation/#findComment-1081962 Share on other sites More sharing options...
volatileboy Posted July 6, 2010 Share Posted July 6, 2010 Try replacing this: if($_GET['page']) { With something like this: if(isset($_GET['page'])) { $pstart = $_GET['page'] * $limit - $limit; } and also $pend should be $limit because you want to show 2 per page right? Quote Link to comment https://forums.phpfreaks.com/topic/206767-page-nevigation/#findComment-1081964 Share on other sites More sharing options...
realcoder Posted July 6, 2010 Author Share Posted July 6, 2010 well m talking about that my page nevigation is not working properly :-\ Quote Link to comment https://forums.phpfreaks.com/topic/206767-page-nevigation/#findComment-1082025 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.