Jump to content

page nevigation


realcoder

Recommended Posts

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>

Link to comment
https://forums.phpfreaks.com/topic/206767-page-nevigation/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.