On 11/9/06, Berlage, Steve <[EMAIL PROTECTED]> wrote:
Here is what I am trying to do: $UPDATE_COMPANY_STRING = "ccompStreet = ?"; $UPDATE_COMPANY_VALUE_STRING = "\$tmpccompStreet"; $sql="UPDATE clientcomp SET $UPDATE_COMPANY_STRING WHERE ccompid = ?"; $sthUpdate = $dbh->prepare($sql); $sthUpdate->execute($UPDATE_COMPANY_VALUE_STRING, $tmpstcompid); Obviously there are many more fields that _may_ be added to the 2 variables that are in all caps (I only showed 1 for simplicity). I only add the fields that need to be updated to those 2 variables. It does what I expect it to do except for the last line. I want the $UPDATE_COMPANY_VALUE_STRING to be expanded to the actual string it contains before the "execute" is run. I've tried a bunch of different ways to make it happen - all to no avail. I either get errors or end up with "$tmpccompStreet" in the database (instead of the value that $tmpccompStreet contains). Hopefully it's clear what I'm trying to accomplish here. Please be kind - I'm relatively new to pl/sql :)
I think you have the wrong data structure for the value string - what you need is an array of values, with the ccompid value at the end and the other values in sequence. So, build the SQL statement one item at a time and add the corresponding value to an array. You then pass the array to the $sth->execute() call. -- Jonathan Leffler <[EMAIL PROTECTED]> #include <disclaimer.h> Guardian of DBD::Informix - v2005.02 - http://dbi.perl.org "I don't suffer from insanity - I enjoy every minute of it."
