in reply to MySQL and Perl... Update record Prob

If you are going to use placeholders you might try prepare()ing and then executing queries rather than using do()

my $query = "UPDATE sometable SET someRecord=? WHERE otherRecord=?"; $sth = $dbh->prepare($query); $sth->execute('value1','value2') or die $sth->errstr();

This seems to be the generally more accepted way of doing things if you are using placeholders.

Also I don't think you want single quotes around table and column names

Hope that helps
Chris

Lobster Aliens Are attacking the world!

Replies are listed 'Best First'.
Re: Re: MySQL and Perl... Update record Prob
by powerhouse (Friar) on Feb 03, 2003 at 18:06 UTC
    This is sooooo strange...
    I changed $in{} to param('')

    like this: $in{tax_id} to param('tax_id') since I'm using cgi-lib for the parsing into %in and :standard for the html creating(textfield(-name ...ect.)

    So even though $in{tax_id} did contain a value, it did not work. the others all work, but not those three feilds. Changing it to param('') worked!

    If they both contain a value, what would make one work and not the other?

    I'm very confused by this. I have at least 15 fields in the update form in the profile form, all of them work with the $in{} method. only those few did not work (html_email, aff_url & tax_id) Every other one, worked, just like it should.

    Any Guru's out there that can help me understand why that is?
    I'd be very thankful!

    Thx,
    Richard.