Howdy,

I've got a web application i've written myself in PHP5 that uses
Postgres 8.1.3 as a database backend and i'm having some issues with
an UPDATE that uses PDO and binds.

In short, PDO is throwing an exception with the following error message:
SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input
syntax for type numeric: ""

The SQL my data objects are generating is:
UPDATE products SET productname=?, productsecondaryname=?,
productmarkup=?, productmarkuptype=?, productsaleprice=?,
productdiscounted=?, productdiscountedprice=?, productregioncode=?,
productaudio=?, productaspectratio=?, productformat=?,
productpublishyear=?, productrating=?, productrunningtime=?,
productdescriptiontext=?

Obviously the '?' marks are where the data binds to, i'm using
bindValue to bind the data, the exact data being output is as below
(excuse the formatting, the framework spits out the binds in that
format when debug is enabled):
DEBUG: Debug string given: (Adding bindValue = 1 : prod one)
DEBUG: Debug string given: (Adding bindValue = 2 : )
DEBUG: Debug string given: (Adding bindValue = 3 : )
DEBUG: Debug string given: (Adding bindValue = 4 : pc)
DEBUG: Debug string given: (Adding bindValue = 5 : )
DEBUG: Debug string given: (Adding bindValue = 6 : 1)
DEBUG: Debug string given: (Adding bindValue = 7 : 98.22)
DEBUG: Debug string given: (Adding bindValue = 8 : )
DEBUG: Debug string given: (Adding bindValue = 9 : )
DEBUG: Debug string given: (Adding bindValue = 10 : )
DEBUG: Debug string given: (Adding bindValue = 11 : )
DEBUG: Debug string given: (Adding bindValue = 12 : )
DEBUG: Debug string given: (Adding bindValue = 13 : PG)
DEBUG: Debug string given: (Adding bindValue = 14 : )
DEBUG: Debug string given: (Adding bindValue = 15 : )

Now, i've been experimenting with the use of the PDO::PARAM_ data
types in an attempt to rectify the exception but this is failing when
it attempts to update/insert data into a field that isnt
PDO::PARAM_INT or PDO::PARAM_STR (fields such as 'cdir' in pgsql).

How would I get around this? Is there a function that returns a more
complete list of data types that suit insert with fields of the types
decimal and the like?

Field 7 in the list is 'productdiscountedprice', it's defined as
numeric(10,2). Perhaps there is a more suitable data type for the
database field?

I am happy to post code samples from my data objects if that will help at all.

Cheers,

James

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to