>1) is the id field a character? in other words, do you need the >quotes? id='10' ?? It is -> ID INT(11) NOT NULL AUTO_INCREMENT and -> PRIMARY KEY(ID)
>2) why not just use >DELETE FROM customer WHERE ID in ('7','8','9','10') >?? Good question I'll try that way. I also have the same prob for and update statement. I'll try it on both. Thanks Dan >-Joe --- Dan Muey <[EMAIL PROTECTED]> wrote: > Here is the deal : I have a script that does quite a bit mysql > manipulation everything works super except one simple delete > statement > > print $query; > This is copied and pasted from the above print statement : > DELETE FROM customer WHERE ID='10' OR ID='9' OR ID='8' OR ID='7' > > $dbh->do($query) or die "Can not execute $query :" . $dbh->errstr . > "\n"; > > It does delete the first record specified ( in this case ID='10' ) > it acts as if the query where just : DELETE FROM customer WHERE > ID='10' > > I get no error messages, it goes on and finishes displaying the > page. > When I've had bad queries before it would just stop at the 'do' > statement and not finish printing the html out for the rest of the > page. > > If I paste that query into the mysql>prompt it works like a charm > and > deletes all. ( with an added semi colon of course ) > > i've usd the prepare/execue method, I've had it do execute a query > for > each id : > foreach $ID(@ids) { > $query = "DELETE FROM customer WHERE ID=\'$ID\'"; > print "$query \n"; > $dbh->do($query) or die "Can not execute $query :" . > $dbh->errstr ."\n"; > $query = ''; > } > results in this output : > > DELETE FROM customer WHERE ID='8' > DELETE FROM customer WHERE ID='9' > DELETE FROM customer WHERE ID='10' > It acts as if only 'DELETE FROM customer WHERE ID='8'' is being > executed > or executed each time but $query is different each time in the > print > statement. > > all have the exact same result - only the first record specified > gets > deleted,( ID='8' above )the script behaves as if the query went ok, > but > they are still > there and if I copy and paste the query into the command line it > works > fine. > > Here's what I got : > > perl, version 5.005_03 built for i386-freebsd > mysql 323 > DBI 1.21 > > Why isn't it doing the entire query from my script? > > Thanks > > Dan