PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
the above code that was just provided gives erro_log message
syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
my code gave responses
UPDATE Users WHERE `username` = 'MisterBob' SET ( PaypalEmail, Email, Password) VALUES('','','d41d8cd98f00b204e9800998ecf8427e')
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 'WHERE `username` = 'MisterBob' SET ( PaypalEmail, Email, Password) VALUES('',''' at line 1
still no luck it appears to be in the where command error as follows
UPDATE Users SET PaypalEmail="", Email="", Password=md5() WHERE username = "MisterBob"
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 ') WHERE username = "MisterBob"' at line 6
Sorry but I am kinda new to this and I am not too sure what you mean, but I went ahead and removed the password part and still getting error
UPDATE Users WHERE `username` = 'MisterBob' SET ( PaypalEmail, Email) VALUES('test@test.com','test@test.com')
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 'WHERE `username` = 'MisterBob' SET ( PaypalEmail, Email) VALUES('test@test.com'' at line 1
you are not using the correct order in SQL :
the order is UPDATE WHERE SET, and the SET part DOES NOT use VALUES you need to do SET field=value, field2=value2 !!!
$qry = '
UPDATE
Users
SET
PaypalEmail="'.mysql_real_escape_string($pemail).'",
Email="'.mysql_real_escape_string($pemail).'",
Password=md5('.$_POST['password'].')
WHERE
`username` = "'.$_SESSION['SESS_Username'].'"';
error =
UPDATE Users SET PaypalEmail="test@test.com", Email="test@test.com", Password=md5() WHERE `username` = "MisterBob"
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 ') WHERE `username` = "MisterBob"' at line 6
The form is going to be there for users to update their details if neccessary so they will need to be able to leave the field blank if they do not want to change it.
I went ahead and tested it with a password anyway with error =
UPDATE Users SET PaypalEmail="test@test.com", Email="test@test.com", Password=md5(testpassword) WHERE `username` = "MisterBob"
Unknown column 'testpassword' in 'field list'
OK that appears to be working fine now and is updating the database. BUT if I leave fields empty I get blank fields in the database. How can I make it so that it doesn't do that?