By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,393 Members | 1,405 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,393 IT Pros & Developers. It's quick & easy.

perl sql insert into not working please help

P: 1
why this code is not working please help. thanks
Expand|Select|Wrap|Line Numbers
  1. my $count = 0;
  2. $count = $dbh->do("INSERT INTO ques (username,userque,userquedetail,userquecatgory,userresponsecount,quegood,quebad,queid,userquedate,quevideo,queaudio,quepic,email)values(?,?,?,?,?,?,?,?,?,?,?,?,?)", 
  3. undef,$usernamenow,$txtque,$txtdetail,$cat,$userresponsecount,$quegood,$quebad,$queid,$userquedate,$txtvideolink,$txtaudiolink,$txtpicturelink,$txtemail);
Jan 25 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 971
Welcome to TSDN!

What errors do you get? When using placeholders you have to have equal number of placeholders as values. It appears that you are passing more values that it is expecting. For me, this convention is more readable.

Expand|Select|Wrap|Line Numbers
  1. my $insert = $dbh->prepare(q{INSERT INTO table (column1, column2) VALUES(?,?)});
  2.    $insert->execute($value1, $value2);
  3.    $insert->finish();                
Jan 25 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.