0

I have created a form that inserts the entered data into the database. It works perfectly except when I put SHA1('$password') into the INSERT INTO VALUSE tag. If I put only '$password it works fine.

Putting SHA1 displays - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

Can you help me out.

Thanks

$q = "insert into users (fullname,email,website,username,password) values ('$fn','$e','$w','$u', SHA1('$password')";
    $r = mysql_query($q) or die(mysql_error()); //Run the query.
Johnson
  • 17
  • 1
  • 1
  • 8
  • Please put some actual code in this post. It is difficult to tell if you are getting this error from the way you submit the query to MySQL or if your MySQL server doesn't support the SHA1() function. – James Sumners Oct 18 '10 at 20:26

1 Answers1

3

Looks like you are missing a parenthesis in your statement. Try:

$q = "insert into users (fullname,email,website,username,password) values ('$fn','$e','$w','$u', SHA1('$password'))";
James Sumners
  • 14,485
  • 10
  • 59
  • 77