Jump to content

mysql select with $_get ?


zero_ZX

Recommended Posts

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? :P

Thanks a lot in advance!

Link to comment
https://forums.phpfreaks.com/topic/183746-mysql-select-with-_get/
Share on other sites

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? :P

Thanks a lot in advance!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.