I was trying to insert an entry to MySQL table using following query.If I use MySQL parameterized query with mysqli, as below, it works without any issues.
insert into notelist(checksum,details,status,location) values('$checksum',JSON_OBJECT('filename','$filename','checksum','$checksum'),0,'$path')
But if I use parameterized query with mysqli as below, the error 'Cannot create a JSON value from a string with CHARACTER SET 'binary' is put into the debug file.Somebody please help to fix this.
$stmt = $con->prepare("insert into notelist(checksum,details,status,location) values(?,?,?,?)");
$stmt->bind_param("sbis", $checksum, $a = "JSON_OBJECT('filename','$filename','checksum','$checksum')", $b = 0, $path);
$result = $stmt->execute();
if (false === $result) {
file_put_contents("db.txt", "connecterror" . $stmt->error);
}