wro Posted May 19, 2010 Share Posted May 19, 2010 Hello all, new to the site and new(ish) to php. I'm attempting to get a registration going for a php game, but it's returning an error. It's returning "could not register" Thanks in advance to any ideas =D $password=md5($password); $date=round(date("U")/1000); srand($date); $thekey=rand(1,100000000); $thekey=md5($thekey); $SQL = "INSERT into wr_users(playername, password, email, str, end, int, luck, dead, turns, gold, validated, validkey) VALUES ('$player', '$password', '$email', '3', '3', '3', '3', '0', '20', '12', '0', '$thekey')"; mysql_query($SQL) or die("could not register"); [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/202243-registration-errors/ Share on other sites More sharing options...
ignace Posted May 19, 2010 Share Posted May 19, 2010 try mysql_query($SQL) or die('Query failed: ' . $SQL . ' (' . mysql_error() . ')'); Quote Link to comment https://forums.phpfreaks.com/topic/202243-registration-errors/#findComment-1060489 Share on other sites More sharing options...
PFMaBiSmAd Posted May 19, 2010 Share Posted May 19, 2010 At least 'int' is a reserved mysql keyword (there is a table of reserved words in the mysql manual.) You either need to rename your int column to something else or enclose it in back-ticks `` every time you use it in a query. Quote Link to comment https://forums.phpfreaks.com/topic/202243-registration-errors/#findComment-1060492 Share on other sites More sharing options...
ignace Posted May 19, 2010 Share Posted May 19, 2010 At least 'int' is a reserved mysql keyword (there is a table of reserved words in the mysql manual.) You either need to rename your int column to something else or enclose it in back-ticks `` every time you use it in a query. Damn, can't believe I didn't notice that. Quote Link to comment https://forums.phpfreaks.com/topic/202243-registration-errors/#findComment-1060501 Share on other sites More sharing options...
wro Posted May 19, 2010 Author Share Posted May 19, 2010 Thank you so much =D Quote Link to comment https://forums.phpfreaks.com/topic/202243-registration-errors/#findComment-1060506 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.