cheat Posted February 3, 2007 Share Posted February 3, 2007 OK IVE BEEN MAKING A MMORPG I HAVE ALL MY SCRIPTS UPLOADED AND THE DATABASE IS DONE BUT WHEN A PLAYER REGISTERING IT IS SAYING THAT THEY HAVE SUCCESSFULLY REGISTERED BUT IS NOT ADDING THEIR DETAILS TO THE DATABASE... I HAVE BEEN TOLD THAT THE FOLLOWING SCRIPT HAS A ERROR THAT IS CAUSING THE PROBLEM PLZ HELP! <?php session_start(); include("conn.php"); $country = $_POST[location]; if ($country == "England") { $drug_prices = "8-13-21-9-106-36-32-103-159"; } elseif ($country == "France") { $drug_prices = "12-54-28-2-129-29-19-97-147"; } elseif ($country == "Italy") { $drug_prices = "10-26-54-19-97-23-25-89-153"; } elseif ($country == "Germany") { $drug_prices = "11-47-13-121-39-12-93-149-131"; } elseif ($country == "China") { $drug_prices = "7-38-17-22-152-27-14-95-144"; } elseif ($country == "Russia") { $drug_prices = "4-41-33-7-122-65-21-94-120"; } elseif ($country == "Mexico") { $drug_prices = "11-40-28-14-136-21-81-100-160"; } elseif ($country == "Japan") { $drug_prices = "9-45-22-63-101-30-100-87-152"; } elseif ($country == "Australia") { $drug_prices = "21-33-27-6-100-35-22-88-133"; } ?> <html> <head> <title>Sign Up</title> <style type="text/css"> <!-- body,td,th { color: #FFFFFF; } body { background-color: #000000; } a:link { color: #00FFFF; text-decoration: underline; } a:visited { text-decoration: underline; color: #00FFFF; } a:hover { text-decoration: none; color: #FFFFFF; } a:active { text-decoration: underline; } --> </style> </head> <body> <?php $time = time(); $email = $_POST["email"]; $user = str_replace(" ", "_", $_POST[username]); $username = strtolower($user); $user_exist = mysql_query("SELECT * FROM users WHERE username='$username'") or die(mysql_error()); if (mysql_num_rows($user_exist) == "1") { echo "Username already in use"; } else { $sql = "INSERT INTO users VALUES ('', '$username', password('$_POST[password]'), '$_POST[full_name]', '$email', '0', '0', '500', 'none', '100', '0', '0', '0', '0', 'alive', '0', '0', '0', '$time', '0', '$country', '0','0', '0', 'no', '', '1', '$drug_prices', '0', 'none', 'middle.jpg', 'none', '$_POST[username]', '0', '0', '0', '0', '0', '1')"; $_SESSION["name"] = $_POST["username"]; if (mysql_query($sql, $conn)) { echo "Succesful signup!<br><a href='index.php'>Sign in</a>"; } else { echo "Unsucessful sign-up please try again"; } } ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
!!!!! Posted February 3, 2007 Share Posted February 3, 2007 Wow... I can't really help but I would like to know what the URL is of the site... I would like to try the MMORPG Quote Link to comment Share on other sites More sharing options...
only one Posted February 3, 2007 Share Posted February 3, 2007 are you sure you are randomising where they are wen they are registering try this $rand=rand(1,9); if($rand==1){ $country=England; } else if($rand==2){ $country=France; ..... Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted February 3, 2007 Share Posted February 3, 2007 Randomising? Where's the random coming from? Your problem is your query: $sql = "INSERT INTO users VALUES ('', '$username', password('$_POST[password]'), '$_POST[full_name]', '$email', '0', '0', '500', 'none', '100', '0', '0', '0', '0', 'alive', '0', '0', '0', '$time', '0', '$country', '0','0', '0', 'no', '', '1', '$drug_prices', '0', 'none', 'middle.jpg', 'none', '$_POST[username]', '0', '0', '0', '0', '0', '1')"; The syntax for an insert is INSERT INTO table_name (comma seperated fields list) VALUES (values like you have, in same order as fields) Quote Link to comment Share on other sites More sharing options...
only one Posted February 3, 2007 Share Posted February 3, 2007 yea, but he wants it to put a country in or not? Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 3, 2007 Share Posted February 3, 2007 there is no randomizing in his script. at the top he gets the country from the form, then checks which country it is to set the drug prices which the OP will be using later on for when people want to buy drugs, i am assuming. Quote Link to comment 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.