This works:
$sql = 'UPDATE Requests SET requested_date=\'2007-01-01\' WHERE request_number=\'0\'';
However, I am have not been able to come up with the proper syntax for replacing the constants in the query with variables.
The variables are $requested_date and $request_number.
What is the correct syntax for using those variables in the Update query?
Thanks,
Roger
Use of variables in a MySQL Update Query
Moderator: General Moderators
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: Use of variables in a MySQL Update Query
You need to read up on basic php! Otherwise you will not get very far.
However, the solution is...
$sql = "UPDATE Requests SET requested_date='".$requested_date."' WHERE request_number='".$request_number."'";
Eddie
However, the solution is...
$sql = "UPDATE Requests SET requested_date='".$requested_date."' WHERE request_number='".$request_number."'";
Eddie
Re: Use of variables in a MySQL Update Query
Thanks, Eddie. 