0

I'm trying to allow users to register with the site I am creating, however the code I am using is not working and I need you're help.

$registerquery = mysql_query("INSERT INTO users (Username, Password, EmailAddress) VALUES('".$username."', '".$password."', '".$email."'");

Database: alt text http://img248.imageshack.us/img248/2457/screenshot20100805at001.png

I only want to store the Username, Password and Email Address at this stage.

3
  • not working? What is the error you get? use mysql_query('.{your query here}.') or die(mysql_error()); to find out Commented Aug 4, 2010 at 23:24
  • How exactly is not working? What error are you getting? Commented Aug 4, 2010 at 23:24
  • post what happen when you use the above code, errors, anything ? Also make sure to use php.net/manual/en/function.mysql-real-escape-string.php so you can filter the data being added to your database instead of falling to the injection abuse. Commented Aug 4, 2010 at 23:26

3 Answers 3

7

You're missing a ) at the end of the query.

$registerquery = mysql_query("INSERT INTO users (Username, Password, EmailAddress) VALUES('".$username."', '".$password."', '".$email."')");
Sign up to request clarification or add additional context in comments.

Comments

0
$registerquery = mysql_query("INSERT INTO `users` (`Username`, `Password`, `EmailAddress`) VALUES ('".$username."', '".$password."', '".$email."')");

Comments

0

You are missing the closing bracket in your SQL query. Try this line:

$registerquery = mysql_query("INSERT INTO users (Username, Password, EmailAddress) VALUES('".$username."', '".$password."', '".$email."')");

Note the ) at the end: "')");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.