Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-03-2007, 08:08 PM   PM User | #1
cheat
New Coder

 
cheat's Avatar
 
Join Date: Nov 2006
Location: England, Britain
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
cheat is an unknown quantity at this point
Registering problem

ok heres a script for complete.php i am making a mmorpg but i am having trouble with the registering, the register.php allows a player to regster but doesnt add to the database, i have been told that the error is somewhere in the following script.
i know that i should upload the file but it wont so ill have post it here..

PHP Code:
<?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>

Last edited by guelphdad; 02-04-2007 at 06:17 AM..
cheat is offline   Reply With Quote
Old 02-03-2007, 08:37 PM   PM User | #2
guelphdad
Super Moderator


 
guelphdad's Avatar
 
Join Date: Mar 2006
Location: St. Catharines, Ontario Canada
Posts: 2,629
Thanks: 4
Thanked 147 Times in 138 Posts
guelphdad will become famous soon enoughguelphdad will become famous soon enough
Please don't post an entire script.

Please don't say "the error" is somewhere in the script. Run the script, report/post the error as well as the line number the error is on.

post the line the error is reported on and a few lines before and after that line.
guelphdad is offline   Reply With Quote
Old 02-03-2007, 09:11 PM   PM User | #3
cheat
New Coder

 
cheat's Avatar
 
Join Date: Nov 2006
Location: England, Britain
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
cheat is an unknown quantity at this point
error

the problem with that is i dont know where the error is i think it might be in the insert but it doesnt show any error when i run the script it allows the person to register but it wont add the details to the database.
cheat is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:55 AM.


Advertisement
Log in to turn off these ads.