- has recently been using the json format of postgresql database and found that pdo query reported an error
- the source code is as follows
<?php
// PDO
$pdo = new PDO("pgsql:host=127.0.0.1;port=5432;dbname=postgres","postgres","");
$statement = $pdo->prepare("select * from test where account::jsonb ? "111"");
$statement->execute();
var_dump($statement->errorInfo());
$rs = $statement->fetch();
var_dump($rs);
//
$p = pg_connect("host=127.0.0.1 port=5432 dbname=postgres user=yluchao password=""");
$rs = pg_query($p, "select * from test where account::jsonb ? "111"");
var_dump(pg_fetch_all($rs));
/*create table test
(
id bigserial primary key,
account jsonb not null default "{}",
name varchar(255) not null default ""
);*/
if the figure uses pdo query to report errors, you can query
using native pgsql links.