Berlage, Steve [mailto:[EMAIL PROTECTED] wrote: > > $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).
$UPDATE_COMPANY_VALUE_STRING is being expanded to the actual string it contains. That string is "\$tmpccompStreet", which is a constant string that has nothing to do with the variable. If you want $UPDATE_COMPANY_VALUE_STRING to contain the value of $tmpccompStreet, then assign $tmpccompStreet: $UPDATE_COMPANY_VALUE_STRING = $tmpccompStreet; Ronald
