Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
table1: std_reg

std_id std_name std_mail
1 xyz xyz@mail.com
2 abc abc@mail.com
3 mno mno@mail.com
4 jkl jkl@mail.com
5 kkk kkk@mail.com
6 ddd ddd@mail.com

I login with mail id " mno@mail.com " and I wanna display next data only ;that is jkl@mail.com , kkk@mail.com & so on that stored in database.

What will be the code in php?

What I have tried:

I have store id of mno@mail.com in a variable; that is

$Name=$_SESSION['name'];
$sel_id=mysql_query("select * from std_reg where std_mail= '$Name'");
$printId=mysql_fetch_array($sel_id);
echo $printId['std_id'];

And I coded print the data from databse is;

$sql = "SELECT * FROM `std_reg`";
$result = mysql_query($sql);
while($row=mysql_fetch_array($result))
{
?>


}
?>
Posted
Updated 22-Apr-16 22:21pm
v2

1 solution

I'm wondering if you can use a subquery to get the std_id in the row where std_mail = mno@mail.com and then the outer query gets everything greater than that std_id ... something like :-

SQL
select * from std_reg 
where std_id > 
(select std_id from std_reg where std_mail= '$Name')
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900