php - How to insert array into crate? -


how insert array crate?

i'm using latest crate-pdo, keep receiving notice

notice: array string conversion in .../crate/pdo/pdostatement.php on line 610

and

array string conversion in .../mypdoclass.php on line 118

i'm using code:

$myarray = ['1', '2', '3', '4', '5'];  $db = new database; $db->query("insert tbl (id, arraycol) values (?,?)"); $db->bind(1, '1'); $db->bind(2, $myarray);  $db->execute(); 

any great, thanks

to bind non-string parameter must use pdo bindvalue() method passing in wanted type 3rd parameter. example:

$statement->bindvalue(2, [1, 2], pdo::param_array) 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -