Php deleting multiple table using join
Hi
I have three tables called Users, Photolevel and Photostatus. In the Users table I have an activekey colunm which is 1 or 0. When its 1 the user is not active when 0 the user is active.
I would like to delete all unactive users from the Users database and from Photolevel , Photostatus.
I have tried a table join with delete which is not working. can any one help.
Photolevel.useid and Photostatus.useid should join and be delete to the Users table where activekey is 1.
Heres the code.
$dbclean=mysql_query("DELETE Users.id, Users.username, Users.surname, Users.email, Users.gender, Users.age, Users.password,
Users.country, Users.city, Users.profilepic,
Users.activecode, Users.activekey, Users.DOB, Users.Date, Photolevel.pid, Photolevel.useid,
Photolevel.genre, Photolevel.start, Photolevel.end, Photostatus.stuid, Photostatus.useid, Photostatus.vgenre
FROM Users, Photolevel, Photostatus WHERE
Users.id = Photolevel.pid AND
Photolevel.pid = Photostatus.stuid AND
Users.activekey='1'");
