paulman888888 Posted May 30, 2008 Share Posted May 30, 2008 I would like a script that when loaded shows the highest id i got this of Madtechic, WHERE GameID = 1 so i thought if i change it i would get, WHERE MAX id echo id But i can't put it into proper PHP script. Quote Link to comment https://forums.phpfreaks.com/topic/108022-solved-yet-another-mind-blank/ Share on other sites More sharing options...
DarkWater Posted May 30, 2008 Share Posted May 30, 2008 You don't put it into the PHP script, you put it in the MySQL query. Quote Link to comment https://forums.phpfreaks.com/topic/108022-solved-yet-another-mind-blank/#findComment-553634 Share on other sites More sharing options...
.josh Posted May 30, 2008 Share Posted May 30, 2008 $r = mysql_query("select max(game_id) from tablenamehere"); $id = mysql_fetch_row($r); echo $id[0]; Quote Link to comment https://forums.phpfreaks.com/topic/108022-solved-yet-another-mind-blank/#findComment-553640 Share on other sites More sharing options...
MadTechie Posted May 30, 2008 Share Posted May 30, 2008 to get the highesty score for all the games try this SELECT GameID, MAX(score) FROM scores GROUP BY GameID or for a single game SELECT GameID, MAX(score) FROM scores WHERE GameID=XX GROUP BY GameID XX = game ID ie EDIT: Crayon Violent beat me Quote Link to comment https://forums.phpfreaks.com/topic/108022-solved-yet-another-mind-blank/#findComment-553643 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.