MySQL Forums
Forum List  »  PHP

Re: insert json into mysql from url with PHP
Posted by: Peter Brawley
Date: March 11, 2022 10:23AM

In your Insert stmt, $json is a string so for MySQL it needs to be quoted. If that isn't the only fix need, to debug ...

$sql = "INSERT INTO db.table (field1) VALUES ( '$json' )" );
echo "sql=$sql";

... copy & paste $sql into the mysql client program, debug it, backfit those fixes into your coded Insert stmt.

Edited 1 time(s). Last edit at 03/14/2022 09:17AM by Peter Brawley.

Options: ReplyQuote

Written By
Re: insert json into mysql from url with PHP
March 11, 2022 10:23AM

Sorry, you can't reply to this topic. It has been closed.

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.