I was hoping for better news. Thanks for the suggestion, but it will put a
very big strain on my application since every DELETE query will open and
close the mysql connection everytime. Think about deleting 100s of records
one at a time. Surely someone has thought of a better way to do this with
MySQL 3.23. Also, I don't want to run persistent connections, as I only have
a limited number of simultaneous connections to the database currently. Is
there a better way to do all this? Anyone?

> -----Original Message-----
> From: Stephen [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 31, 2002 1:10 PM
> To: @ Nilaab
> Cc: PHP List
> Subject: Re: [PHP] How To Delete Multiple Items Of Multiple Tables Using
> PHP and MySQL
>
>
> From experience, I don't think you can run more then one SQL statement at
> once in a single time. Try assigning each variable with delete, then query
> them all seperately. I also don't think you need the ; in the SQL
> statement...
>
>
> ----- Original Message -----
> From: "@ Nilaab" <[EMAIL PROTECTED]>
> To: "Php-General" <[EMAIL PROTECTED]>
> Sent: Tuesday, December 31, 2002 1:36 PM
> Subject: [PHP] How To Delete Multiple Items Of Multiple Tables
> Using PHP and
> MySQL
>
>
> : 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 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
> :
> :
> :
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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

Reply via email to