zero_ZX Posted December 2, 2009 Share Posted December 2, 2009 Hi, i have this code: // If char id is 0 and character dont exist do: if ($_GET["id"] == "0") { die "A character ID can never be 0. This character does not exists or have not been created yet! <br> Please create a new character first."; } else // Get the character stats from the wc_characters table $charinfo = mysql_query("SELECT CharacterId, class, points, level, xp, reqxp, money, str, agi, inte, sta, backs, chests, feet, hands, helmets, legs, necks, wrists, leftweapons, rightweapons, waists, tinkers, shoulders, rings, profession1, profession2, playerId, hp, mn, armor, dps, rank FROM wc_characters WHERE CharacterId ='$_SESSION[valid_user]'") or die(mysql_error()); Now for my where clause, i want the ID = the ID the user inputs in the URL, like here: if ($_GET["id"] == "0") So if a user gets to a url like ?id=1 it should select where characterid = 1 How is this possible? Thanks a lot in advance! Link to comment https://forums.phpfreaks.com/topic/183746-mysql-select-with-_get/ Share on other sites More sharing options...
Gayner Posted December 2, 2009 Share Posted December 2, 2009 Hi, i have this code: // If char id is 0 and character dont exist do: if ($_GET["id"] == "0") { die "A character ID can never be 0. This character does not exists or have not been created yet! <br> Please create a new character first."; } else // Get the character stats from the wc_characters table $charinfo = mysql_query("SELECT CharacterId, class, points, level, xp, reqxp, money, str, agi, inte, sta, backs, chests, feet, hands, helmets, legs, necks, wrists, leftweapons, rightweapons, waists, tinkers, shoulders, rings, profession1, profession2, playerId, hp, mn, armor, dps, rank FROM wc_characters WHERE CharacterId ='$_SESSION[valid_user]'") or die(mysql_error()); lol u alrdy have it use the $_GET['id'] code u got Now for my where clause, i want the ID = the ID the user inputs in the URL, like here: if ($_GET["id"] == "0") So if a user gets to a url like ?id=1 it should select where characterid = 1 How is this possible? Thanks a lot in advance! Link to comment https://forums.phpfreaks.com/topic/183746-mysql-select-with-_get/#findComment-969842 Share on other sites More sharing options...
zero_ZX Posted December 2, 2009 Author Share Posted December 2, 2009 Yea i tried this, but WHERE CharacterId = '$_GET['id']'") Gives me errors :/ Ops stupid by me lol, here's the fix for my "second problem" : WHERE CharacterId = '$_GET[id]'") Thanks for your help! Link to comment https://forums.phpfreaks.com/topic/183746-mysql-select-with-_get/#findComment-969871 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.