views:

42

answers:

1

Hi,

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.
+2  A: 

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'))";
jsumners
Oh Geez! I am so sorry. Thank you for all your help. It worked.
Johnson
So if my answer is the answer, how about accepting it?
jsumners