+ Reply to Thread
Results 1 to 2 of 2

Thread: Mysql : Insert Command error

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    15

    Mysql : Insert Command error

    The Idea : a user changes his password and i store his username and new password and confirmation code into table.
    Here is the code i created :
    Code:
    $insertResult=mysql_query("INSERT INTO TempChangePass (UserName, NewPass, ConfirmationCode) VALUES ('$UserName', '$newPass', '$code')") or die (mysql_error());
    But i get this error:
    Code:
    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 'username'', '4da59df8d4007807e7230e0881fbf774', '16585482')' at line 1

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    8
    Remove the single quotes around your variables. PHP is interpreting them as strings.
    Code:
    $insertResult=mysql_query("INSERT INTO TempChangePass (UserName, NewPass, ConfirmationCode) VALUES ('" . $UserName. "', '" . $newPass. "', '" . $code . "')") or die (mysql_error());

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts