CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 How to delete entries across multiple tables

Print topic Send  topic

Author Message
cchipman

Posts: 7
Posted: 10/06/2004, 9:34 AM

I have one table that contains composition details. Each composition has an id column. There are about 20 other tables which contain test results for each composition, which is linked by an id field labeled as "comp_id".

I tried using the custom delete routine with the following entry:

DELETE FROM compimages WHERE  comp_id = {comp_id};  
DELETE FROM composition WHERE  comp_id = {comp_id};


however, I got the following error message...

Database error: Invalid SQL: DELETE FROM compimages WHERE comp_id = 73; DELETE FROM composition WHERE comp_id = 73;  
MySQL Error: 1064 (You have an error in your SQL syntax near '; DELETE FROM composition WHERE comp_id = 73' at line 1)  
Session halted.

If I enter the lines from the error message above :

DELETE FROM compimages WHERE comp_id = 73; DELETE FROM composition WHERE comp_id = 73;

MySQL deletes them fine. So I suspect I'm not doing something correct. Can anyone offer me any advice?
_________________
Carl Chipman
View profile  Send private message
Karsten


Posts: 57
Posted: 10/08/2004, 4:38 PM

hi cchipman,

Quote :
DELETE FROM compimages WHERE comp_id = 73; DELETE FROM composition WHERE comp_id = 73;

this works?
if so its new to me CCS supports multible deletes/inserts/updates
are you sure, that both tables are touched and and both records are deleted?

Karsten from Germany

_________________
If one gives up, he told himself he failed.
View profile  Send private message
cchipman

Posts: 7
Posted: 10/25/2004, 10:00 AM

It works if entered from the commandline or from phpMySqlAdmin tool. It doesn't work with the custom delete section though.
_________________
Carl Chipman
View profile  Send private message
GeorgeS

Posts: 206
Posted: 10/25/2004, 10:48 AM

I had some strange errors when I was trying to use {} brackets.

Try getting the value of the control differently if possible.
"DELETE FROM compimages WHERE comp_id =" .$form->conrol->GetValue(); ...?...
Maybe it will help...
_________________
GeorgeS
View profile  Send private message
peterr


Posts: 5971
Posted: 10/25/2004, 1:49 PM

You are working with PHP, not MySQL, therefore you need to follow PHP rules. Since PHP doesn't allow multiple SQL statements then this cannot work. Just write your custom code in two PHP lines instead of one.
Also see http://forums.devshed.com/archive/t-172340
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
mrachow


Posts: 509
Posted: 10/26/2004, 1:11 AM

I have found this:
http://www.samspublishing.com/articles/article.asp?p=30875&seqNum=6
on Multiple Table Deletes and Updates for MySQL.

Regards,
Michael
_________________
Best regards,
Michael
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.