I am trying to insert a value in a PostgreSQL database to use PPO PDO, but the following error message Contesting:
SQLSTATE [22P02]: Invalid text representation: 7 Error: Array value should start with "{" or dimension information Field type is one.
Here is my code (simplified):
Try {$ sql = 'Include in the table (field name, foo) value (?,?)'; $ FIELDNAME = array ('1', '2'); $ Data = array ($ area name, 'bar'); # FieldName is PostgreSQL $ STH = $ conn- & gt; Array type in ready ($ sql); $ STH- & gt; Execute ($ data); Hold (PDOException $ e) {# Handle exception} Thanks!
If at any time it comes to it, then the solution was to throw the array and {}.
$ fieldName = '{' Implode (",", $ fieldName) '}';
No comments:
Post a Comment