At 11:33 -0600 28/01/2011, Puneet Kishor wrote:

>  > Why would you do this rather than use $dbh->do ?  It seems to add a
>>  line of code to no purpose.
>
>Because I find using bind values easier, clearer, and safer, even for
>one-off execute statements.

Well, that makes sense.

>  > And besides, whereas the 'do' routine
>  > works fine in the standalone script, yours works in neither.
>
>I didn't try my code, but I am curious -- what do you mean by "works in
>neither"? do you get any error? or, is the row not deleted at all? or both?


Well now I have inserted your routine in the cgi script at

<http://bd8.com/cgi-bin/iceman.pl>

There are five rows in the table and when the delete button is 
pressed the row should be deleted.  According to thec $rows_affected 
report it has been deleted, but all five records persist.


print qq~<p class="temp">\$q{BUTTON} was: $q{BUTTON}</h2></p>~;
if ($q{BUTTON} =~ s~^Delete[^\d]+~~i){
   print qq~<p class="temp">\$q{BUTTON}=$q{BUTTON}</p>~;
   #######my $rows = $dbh->do("DELETE FROM contacts WHERE rowid = $q{BUTTON}");
   my $sth = $dbh->prepare('DELETE FROM contacts WHERE rowid = ?');
   my $rows_affected = "none"; # default
   $rows_affected = $sth->execute($q{BUTTON});
   print qq~<p class="temp">\$rows_affected: $rows_affected</p>~;

}

At least there is some progress, but why are the reportedly deleted 
rows reappearing when the search is renewed?

JD
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to