1

I'm using WAMP to develop offline an application. My WAMP Database version is:

Server: mysql wampserver (127.0.0.1 via TCP/IP)
Tipo di server: MySQL
Versione del server: 5.6.17 - MySQL Community Server (GPL)

then I have an update query in PHP like this that work fine on WAMP:

$id = 1;
$field = array("OptColumnView" => 0);

$sql = "UPDATE table SET OptColumn = ? WHERE ID = ?";

try {
        $rs = $db->prepare($sql);
        $rs->execute(array(json_encode($field), $id));
    } catch(PDOException $e) {
        die($e);
    }

But if I upload this online on my server that has:

 Server: Localhost via UNIX socket
Tipo di server: MariaDB
Versione del server: 10.1.41-MariaDB-cll-lve - MariaDB Server
Versione protocollo: 10 

I get error:

Syntax error or access violation: 1064 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 'OptColumn = "{\"OptColumnView\":0}' WHERE ID = '1" at line .......... 

Is it a MariaDB problem compatibility?

Giuseppe Lodi Rizzini
  • 1,045
  • 11
  • 33

0 Answers0