hossfly007 Posted April 28, 2007 Share Posted April 28, 2007 What is the command to view the last result in a table using a DB query? Table Example TABLE PEOPLE >ID >NAME >POINTS one thing, it cant be ORDER BY id DESC If at all possible it has to be SELECT * FROM people WHERE name=jon && id=**last id** **last id** = Last id where the name jon was found. Link to comment https://forums.phpfreaks.com/topic/49022-pulling-data-from-the-last-field-of-a-table/ Share on other sites More sharing options...
tauchai83 Posted April 28, 2007 Share Posted April 28, 2007 i guess the idea is: yout add ASC (ascending) , then add LIMIT 1? make sense? can i see ur query 1st? Link to comment https://forums.phpfreaks.com/topic/49022-pulling-data-from-the-last-field-of-a-table/#findComment-240145 Share on other sites More sharing options...
hossfly007 Posted April 28, 2007 Author Share Posted April 28, 2007 $query2 = mysql_query("SELECT * FROM ladiesleague2007 WHERE player='{$data4['player']}' ORDER BY handicap_new DESC LIMIT 1"); It's pulling in the wrong information half are right the rest are ASC Instead of pulling all the fields and sorting them, i would really like to find out how to find the "last field" that {$data4['player']} is in. It gets alittle more indepth code wise Link to comment https://forums.phpfreaks.com/topic/49022-pulling-data-from-the-last-field-of-a-table/#findComment-240146 Share on other sites More sharing options...
tauchai83 Posted April 28, 2007 Share Posted April 28, 2007 $player=$data4['player']; $sql="SELECT * FROM ladiesleague2007 WHERE player='$player' ORDER BY handicap_new DESC LIMIT 1 GROUP BY player"; try this and see. Link to comment https://forums.phpfreaks.com/topic/49022-pulling-data-from-the-last-field-of-a-table/#findComment-240153 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.