Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

91 users online



deleting records from multiple tables

deleting records from multiple tables

Currently viewing this thread: 1 (0 members and 1 guests)


ferhanz

ferhanz

Neverside Newbie
Status: Offline!

deleting records from multiple tables

i have got 3 tables

1) student:
student_id
student_name
student_address

2)subjects
subject_id
student_id
subject_name

3)hobbies
hobby_id
student_id
hobby_name

what i want is that when i delete the record from student table it should delete all the records of that id from subjects and hobbies table, i am using phpmyadmin for creating tables and the type of the table is default MyISAM

Thanks

Farhan Nawazish

___________________

When it all becomes DARK
www.mobilevaganza.com

phpmonkey

phpmonkey

whoa, wtf?
Status: Offline!

What version of PHP do you have? If you have MySQL 4.0 or greater you can do a multitable delete

DELETE FROM `student`,`subject`,`hobbies` WHERE `student`.`student_id`=1337 AND `student`.`student_id`=`subjects`.`student_id` AND `student`.`student_id` = `hobbies`.`student_id`

___________________

Fomerly known as lasnaranjas. Holler.
http://card.mygamercard.net/gelsig/blackdood.png

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0066 seconds.