This question already has an answer here:
I have actually tried this query in PhpMyAdmin and it is fine:
UPDATE guest_information
SET GuestFirstname='$firstname' , GuestLastName='$lastname', GuestMiddleName='$middlename',
Birthdate=$birthdate, Gender='$gender', PhoneNumber='$phone', MobileNumber='$mobile', Address='$address', EmailAddress='$email'
WHERE ReservationCode=$code"
But when I put it as a query in my php it produces an error like this:
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in \PATH_FILE\TO\MY\PHPFILE.PHP on line 1048 Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE ReservationCode=3876980' at line 4
I output all the variables that I have used and they all have the values, what is the problem in here? Thank you very much.
</div>
You have forgot to make "$birthdate and $code" as string, this code will work for you.
UPDATE guest_information
SET GuestFirstname='$firstname', GuestLastName='$lastname', GuestMiddleName='$middlename',
Birthdate='$birthdate', Gender='$gender', PhoneNumber='$phone', MobileNumber='$mobile', Address='$address', EmailAddress='$email'
WHERE ReservationCode='$code'