Jason, thanks, but see if you can you read the initial question and try to
answer that one for me. You are a great help with resources when I need
them. Your help is always appreciated. The origial clip is as follows
(concentrate on the ending question):



Hello Everyone,

I want to DELETE multiple items of multiple TABLES in a MySQL database. My
version of MySQL is 3.23, which means this version doesn't support the
DELETE functionality on multiple tables. The following is my PHP code, where
$item_id is a multi-dimensional array containing the ids of the many items I
want to delete from the table.

   # DELETE records
   for ($i = 0; $i < count($item_id); $i++) {
     $query_item2 .=  "DELETE QUICK FROM item_dimension WHERE item_id =
'".$item_id[$i][0]."'; ";
     $query_item2 .= "DELETE QUICK FROM item_popup WHERE item_id =
'".$item_id[$i][0]."'; ";
   }

When I run this through the database using PHP, it returns a syntax error in
the SQL. So what I did was echo out $query_item2, then copied and pasted the
SQL into the MySQL application manually, and ran it through. Well the exact
same SQL statement that I used in PHP worked when I entered it manually in
MySQL. In other words it didn't work doing it through PHP, but it worked in
MySQL directly. What gives?

Is there a better way to delete multiple items
from multiple tables with one SQL string? I don't want to separate the two
DELETE functions and run them through two separate times because of overhead
concerns. I tried looking on the MySQL and PHP website for better ways of
using DELETE syntax on multiple tables, but I had no luck finding anything
useful with my version of MySQL. Any help would be greatly appreciated.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to