Php Mysql Code
We are looking for code that will delete profiles (rows) from several tables based on a query.
The initial query:
SELECT member_id FROM `profile` WHERE (`status` = 3 AND `continent` = 6 AND country = 207) OR (`status` = 3 AND `continent` = 6 AND country = 80);
will result in several rows from member_id field displayed from the profile table
I then want to perform a delete operation on several tables based on the results of the above query.
The delete code i currently use when deleting 1 by 1 is below. I need the code to take into account that the new input will now be the query above:
$query = “select member_id from profile where id = ‘$del_id'”;
$row = f(q($query));
$query = “delete from relationship_x where profile_id = $del_id”;
q($query);
$query = “delete from interests_x where profile_id = $del_id”;
q($query);
$query = “delete from address_book where member_id = $row[member_id]”;
q($query);
$query = “delete from favourites where owner_id = $row[member_id]”;
q($query);
Hope this makes sense. I realise this is probably pretty easy – if possible paste the solution in the PMB. First correct working script will win the project.