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

SELECT * FROM emails LIMIT (1, 10)

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

SELECT * FROM emails LIMIT (11,10)

For the second page. Repeat, and you have it

hello use this code:

$t="select * from `yourtable` ";
$i=mysql_query($t);
$row=mysql_fetch_array($i);
 $n="select * from yourtable where id > '".$row['id']."'";
$p=mysql_query($n);
$d=mysql_fetch_array($p);//here you will get next message...
 $nextid=$d['id'];
 $previd=$row['id'];

you just pass the $nextid and $previd to your nextpage...

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.

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:

// File: viewmail.php?id=2

<?php
// security
if(!(is_numeric($_GET['id'])))
{
echo 'Error';
}

$id = $_GET['id'];
$query = mysql_query("SELECT * FROM emails WHERE id = $id");

while ($rows = mysql_fetch_array($query, MYSQL_ASSOC)
{
// print out whatever information (subject, author, time, text, etc.)
}
?>

<a href="viewmail.php?id=<?php echo $id--; ?>">Previous email</a>
<a href="viewmail.php?id=<?php echo $id++; ?>">Next email</a>
This article has been dead for over six months. Start a new discussion instead.