RE: Bind variable question




Berlage, Steve [mailto:Steve.Berlage@xxxxxxxxxxx] 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


.



Relevant Pages

  • assistance with moving through loops
    ... the complexity(or simplicity) of the loop. ... I appear to be putting bandaids ... string fmtstart=tbStart.Text.ToString; ...
    (microsoft.public.dotnet.languages.csharp)
  • Generic Web Service Support
    ... I would like to write a simple web service (for simplicity, ... stateless, returns a string given a couple of strings as arguments, ... say) as a Java class and then "plug it in" to a server that provides a ... posts them as URL parameters to the ...
    (comp.lang.java.programmer)
  • Re: bug reading /proc/sys/kernel/*: only first byte read.
    ... Eric W. Biederman wrote: ... deliberately for simplicity. ... Getting the string side of this fixed even by itself is ... worthwhile, although it might be worth teach people ...
    (Linux-Kernel)
  • Re: Identifying an exact binary representation
    ... Bernhard Enders wrote: ... simplicity, it is not necessary to represent it as a string, maybe it ...
    (comp.lang.fortran)
  • Re: Step Mode Values
    ... there's a small but important difference: e-mail adresses aren't ... case-sensitive but string comparisons are. ... The issue is the caption in Step Mode shows a value in all CAPS but the ...
    (microsoft.public.outlook.program_vba)