Just a quick and simple question:
I am using php and am looking to update a field with values from a field in another table.
I have the syntax working fine in mysql, but can’t seem to get it right in php.
example
tbl_1:
UID | Message | customer_email
tbl_2
AccountNumber | customer_email
update tbl_1
set tbl_1.Message = REPLACE(Message,'FOO',AccountNumber)
from
tbl_1 inner join tbl_2 on tbl_1.customer_email = tbl_2.customer_email;
Any ideas?
Your query should work as is. The PHP doesn’t manipulate the SQL, it just passes it on.
Also, remember that if you are passing user input to the database, always sanitize it (or use PDO and save yourself).