| | |
Problem...in page navigation
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jun 2008
Posts: 142
Reputation:
Solved Threads: 0
Hi, here is the code for page navigation, its working fine but , if there are 4 pages , each page is displaying 3 records per page, if we go to 3rd page, and click on the subject it will display the contents but it will automatically come to the 1st page,,,,,,i dont want it to come to the first page. i want it to be remain in the same page where the user has clicked .......because i my code in half page i am showing records, if he click on some subject , in the second half of the page it is displaying contents as soon as he clicks.....so if he goes to 4th page and clicks on some subject it will show the contents but the first half portion of the page where i am displaying the records will automatically go to first page,,,,,,,,,,the second part will remain same......so help me out
here is the code..
here is the code..
php Syntax (Toggle Plain Text)
<? session_start(); include('database.php'); $page_name="contractor_inbox.php"; //$limit=sql_quote($_GET['limit']); // Read the limit value from query string. $limit=$_GET['limit']; //$start=sql_quote($_GET['start']); // To take care global variable if OFF $start=$_GET['start']; if(!($start > 0)) { // This variable is set to zero for the first page $start = 0; } $eu = ($start - 0); if(!$limit > 0 ) { // if limit value is not available then let us use a default value $limit = 4; // No of records to be shown per page by default. } $this1 = $eu + $limit; $back = $eu - $limit; $next = $eu + $limit; //*****************************************************************/ $result = mysql_query("SELECT * FROM autoalto_mail where flag!='1' limit $eu, $limit" ); //code for paging //************************************************************************** $selcount = "SELECT * FROM autoalto_mail ORDER BY primarykey column name DESC" ; $selcount = "SELECT * FROM autoalto_mail where flag!='1'" ; $result2=mysql_query($selcount); $nume=mysql_num_rows($result2); //echo $nume; //session_register("nume"); //$nume = $_SESSION['nume']; //session_register("nume"); $_SESSION['nume']=$nume; //echo "<table>"; //************************************************************************** while($row = mysql_fetch_array($result)) {?> <tr class="sectiontableentry2" ><!--<td width="5%"></td>--> <td><? echo $row['From_user'];?></td> <td><a href="contractor_inbox.php?mail_id=<? echo $row['mail_id']; //session_register("mail_id"); //session_register("mail_id"); ?>"> <?echo $row['subject']; $subj=$row['subject']; session_register("subj");?> </a></td> <td><?echo $row['date'];?></td> </tr> <!--<tr class="sectiontableentry1"></tr> <!--<tr class="sectiontableentry1"><td width="5%"></td> <td colspan="4" style="background-repeat: repeat-x;" background="images/dot.jpg" height="0" width="300"></td></tr>--> <? }?> </table> <? if($nume > $limit) { //Counting no of pages and the current page. $totnumofpages = round($nume/$limit); $i=0; $l=1; for($i=0;$i < $nume;$i=$i+$limit) { if($i == $eu) { $currentpage= $l; } $l=$l+1; } echo "<div height=28 align=right><table cellpadding=3 cellspacing=1 border=0 height=28><tr><td>Page ".$currentpage." / ".$totnumofpages."</td>"; //// if our variable $back is equal to 0 or more then only we will display the link to move back //////// if($back >=0) { print "<td align='left'><a href='$page_name?start=$back&limit=$limit'><</a></td>"; } //////////////// We will not display the current page as a link /////////// $i=0; $l=1; for($i=0;$i < $nume;$i=$i+$limit) { if($i <> $eu) { echo "<td align=center><a href='$page_name?start=$i&limit=$limit'><span>$l</span></a></td>"; } else { echo "<td align=center><span><b>$l</b></span></td>"; } /// Current page is not displayed as link $l=$l+1; } ///////////// If we are not in the last page then Next link will be displayed. Here we check that ///// if($this1 < $nume) { print "<td align=center width=15><a href='$page_name?start=$next&limit=$limit'><span ><b>></b></span></a></td>"; } echo "</tr></table></div>"; } mysql_close(); ?>
Hi,
Modify the following line.
with
Modify the following line.
PHP Syntax (Toggle Plain Text)
<a href="contractor_inbox.php?mail_id=<? echo $row['mail_id'];//session_register("mail_id");//session_register("mail_id");?>">
with
PHP Syntax (Toggle Plain Text)
><a href="contractor_inbox.php?start=$start&limit=$limit&mail_id=<? echo $row['mail_id']; //session_register("mail_id");//session_register("mail_id");?>">
Vivek Rawat
Keep solving complexities.
Keep solving complexities.
Ohh sorry, use this.
PHP Syntax (Toggle Plain Text)
<a href="contractor_inbox.php?start=<?=$start?>&limit=<?=$limit?>&mail_id=<?=$row['mail_id'];?>">
Vivek Rawat
Keep solving complexities.
Keep solving complexities.
![]() |
Similar Threads
- Change IE "Action Canceled" page?? (Web Browsers)
- PHP Navigation help please (PHP)
- CSS position problem (HTML and CSS)
- Scrolling tables problem (HTML and CSS)
- Router is slower than adapter (Network Security)
- Parse error at last line of page's code (PHP)
- Navigation Bar that extends the length of the page (HTML and CSS)
- Problem - IE Synchronize navigation (Web Browsers)
- Mouse over buttons on .js file? Urgent-help (JavaScript / DHTML / AJAX)
Other Threads in the PHP Forum
- Previous Thread: Encrypt url to hide form field results
- Next Thread: Create Crystal Report using PHP, Mysql
| Thread Tools | Search this Thread |
action address ajax apache api array auto autoincrement beginner binary broken cakephp checkbox class classes cms code cron curl database date dehasher destroy display domain dynamic echo email error errorlog fatalerror file files folder form forms function functions google href htaccess html if-else image images include insert integration ip java javascript joomla legislation limit link load login mail masterthesis menu mlm multiple mysql oop open paypal pdf php popup problem query radio random record recursion regex remote script search security server sessions sms soap source space sql syntax system table tutorial update upload url validator variable video web xml youtube





