MySQL Forums
Forum List  »  PHP

Re: MySQL Query Using PHP not working
Posted by: Peter Brawley
Date: January 11, 2018 11:54AM

> $sql = "INSERT INTO 'ProvidersDevices' (UserID, DeviceID, IsLive, sLiveLastUpdated) VALUES (1, '456', 1, '" .$date. "' ") ";

Don't quote identifier names. If they contain chars that are illegal in identifier names, surround them with backticks (`).

In general, when a query elicits an error, have the code echo the query being sent to MySQL, eg ...

echo $sql

before executing it, so you can copy & paste it into the mysql client for debugging.

Options: ReplyQuote

Written By
Re: MySQL Query Using PHP not working
January 11, 2018 11:54AM

Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.