chriso has asked for the wisdom of the Perl Monks concerning the following question:
I'm getting a syntax error for the following perl/mysql statement. Can you tell me what is wrong and how to fix it?
Here is the error message:
DBD::mysql::st execute failed: You have an error in your SQL syntax near 'cleaner and unit=cn and qty=15 and cost=1.35 WHERE id = 19' at line 1
Here is the code
my $sth =$dbh ->prepare ("UPDATE products set pname=$pname and unit=$ +unit and qty=$qty and cost=$cost WHERE id = $pid");
pname should be "drain cleaner", unit should be "cn", qty should be 15, and cost should be 1.35. Thanks. Chris. Never mind, I figured it out.
Back to
Seekers of Perl Wisdom