Next button:Help

Reply

Join Date: Jun 2008
Posts: 142
Reputation: ishlux is an unknown quantity at this point 
Solved Threads: 0
ishlux ishlux is offline Offline
Junior Poster

Next button:Help

 
0
  #1
Aug 4th, 2008
Hi all,
I have an inbox, if i click on the inbox which will display list of mails. now i have next button,
if i click on the next button it should be possible to display the next mail with respect to the current opened mail.
how to do this . Pls help me out.







Thanks in advance
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 48
Reputation: Demiloy is an unknown quantity at this point 
Solved Threads: 4
Demiloy Demiloy is offline Offline
Light Poster

Re: Next button:Help

 
0
  #2
Aug 4th, 2008
  1. SELECT * FROM emails LIMIT (1, 10)

That would be the SQL query for your first page. Then:

  1. SELECT * FROM emails LIMIT (11,10)

For the second page. Repeat, and you have it
Last edited by peter_budo; Aug 4th, 2008 at 6:48 am. Reason: Keep It Organized - please use [code] tags
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: Next button:Help

 
0
  #3
Aug 4th, 2008
hello use this code:
  1. $t="select * from `yourtable` ";
  2. $i=mysql_query($t);
  3. $row=mysql_fetch_array($i);
  4. $n="select * from yourtable where id > '".$row['id']."'";
  5. $p=mysql_query($n);
  6. $d=mysql_fetch_array($p);//here you will get next message...
  7. $nextid=$d['id'];
  8. $previd=$row['id'];


you just pass the $nextid and $previd to your nextpage...
Last edited by Shanti Chepuru; Aug 4th, 2008 at 4:03 am.
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 142
Reputation: ishlux is an unknown quantity at this point 
Solved Threads: 0
ishlux ishlux is offline Offline
Junior Poster

Re: Next button:Help

 
0
  #4
Aug 4th, 2008
No its not like that, see if the current mail is 2nd and if i click on the next link it should be possible to open the 3rd mail. which ever i open , if i click on the next link. it should be possible to open the next mail corresponding to the opened current mail.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 48
Reputation: Demiloy is an unknown quantity at this point 
Solved Threads: 4
Demiloy Demiloy is offline Offline
Light Poster

Re: Next button:Help

 
0
  #5
Aug 4th, 2008
Originally Posted by ishlux View Post
No its not like that, see if the current mail is 2nd and if i click on the next link it should be possible to open the 3rd mail. which ever i open , if i click on the next link. it should be possible to open the next mail corresponding to the opened current mail.
This should be the solution:

  1. // File: viewmail.php?id=2
  2.  
  3. <?php
  4. // security
  5. if(!(is_numeric($_GET['id'])))
  6. {
  7. echo 'Error';
  8. }
  9.  
  10. $id = $_GET['id'];
  11. $query = mysql_query("SELECT * FROM emails WHERE id = $id");
  12.  
  13. while ($rows = mysql_fetch_array($query, MYSQL_ASSOC)
  14. {
  15. // print out whatever information (subject, author, time, text, etc.)
  16. }
  17. ?>
  18.  
  19. <a href="viewmail.php?id=<?php echo $id--; ?>">Previous email</a>
  20. <a href="viewmail.php?id=<?php echo $id++; ?>">Next email</a>
Last edited by Demiloy; Aug 4th, 2008 at 4:12 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC