GetDotted Domains

Viewing Thread:
"PHP/SQL - Deleting from multiplie tables"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Mon 21/02/05 at 23:15
Regular
Posts: 10,364
Hi there.

Gonna keep this short.

Anyone know a way of deleting a record from multiple tables?

I tried this syntax: -

DELETE * FROM auction,keyfeatures,images WHERE ID=$theID

Doesn't want to work though.

The table 'auction' uses what is in $theid as it's primary key.

The other two tables have whatever $theid is as it's secondary key

Cheers for any help.
Tue 22/02/05 at 13:17
Regular
"Bicycle"
Posts: 4,899
And that's exactly why I hates it.
Tue 22/02/05 at 11:55
Regular
Posts: 10,364
In a random turn of events, it has finally just got working.

Cheers everyone.

(MySQL is so unpredictable at times....)
Tue 22/02/05 at 11:51
Regular
Posts: 10,364
Error: Unknown table 'auctionid' in MULTI DELETE

I think you have to list all of the tables you wish to delete from after the "delete" keyword and the "from" one.
Tue 22/02/05 at 11:46
Regular
Posts: 138
gamesfreak wrote:
Try

> DELETE AuctionID FROM auction,keyfeatures,images
> WHERE auction.AuctionID=keyfeatures.AuctionID AND
> keyfeatures.AuctionID=images.AuctionID AND auction.AuctionID='$theitem'
Tue 22/02/05 at 11:40
Regular
Posts: 10,364
Argh, I just keep getting this error: -

Error: Unknown column '72568bf531e97cca0a4744d5e7b00c3c' in 'where clause'

With this syntax: -

DELETE auction,keyfeatures,images FROM auction,keyfeatures,images WHERE auction.AuctionID=$theitem AND auction.AuctionID=keyfeatures.AuctionID AND keyfeatures.AuctionID=images.AuctionID

I've checked the manual and from what I can see it's all OK....
Tue 22/02/05 at 09:39
Regular
"Bicycle"
Posts: 4,899
Well yeah, but it's not logical enough for me..
Tue 22/02/05 at 09:26
Regular
"NULL"
Posts: 1,384
Pourquoi? MySQL is excellent!
Tue 22/02/05 at 07:22
Regular
"Bicycle"
Posts: 4,899
Ugh, I detest mySQL. I mean, I use it, with PHP and phpMyAdmin, but I hate it.
Tue 22/02/05 at 00:04
Regular
"Chavez, just hush.."
Posts: 11,080
Can't you just have 3 different queereeeees?

DELETE * FROM auction WHERE ID=$theID
DELETE * FROM keyfeatures WHERE ID=$theID
DELETE * FROM images WHERE ID=$theID
Tue 22/02/05 at 00:04
Regular
"Devil in disguise"
Posts: 3,151
You need to create a join I guess, something like...

DELETE auction,keyfeatures,images FROM auction,keyfeatures,images WHERE auction.id=keyfeatures.id and keyfeatures.id=images.id and auction.id=$theID

Check the mysql docs for the exact syntax.

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Best Provider
The best provider I know of, never a problem, recommend highly
Paul
My website looks tremendous!
Fantastic site, easy to follow, simple guides... impressed with whole package. My website looks tremendous. You don't need to be a rocket scientist to set this up, Freeola helps you step-by-step.
Susan

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.