lexington
04-18-2007, 09:48 PM
It seems that every programmer that I pay is away so I am trying my best to figure out some things myself but having problems. Basically I created a simple line of code that deletes data from another database when ran. (replace blah with real name of db)
mysql_query("DELETE from blah_table where blah_name = '".$_post['band_name']."' LIMIT 1");
That works, but there are other db tables that only contain the user_id and not the blah_name table. So I used this code:
mysql_query("SELECT user_id FROM blah_table WHERE blah_name = '".$_post['band_name']."' LIMIT 1");
That works as well, but how can I write the script so that it detects the user_id from the other database and deletes other data from other tables? I can enter the table data myself but I do not know how to write the script to detect the user_id to delete from other tables. That way the other commands would be like:
mysql_query("DELETE FROM other_table WHERE user_id= 'USER ID HERE' LIMIT 1");
mysql_query("DELETE from blah_table where blah_name = '".$_post['band_name']."' LIMIT 1");
That works, but there are other db tables that only contain the user_id and not the blah_name table. So I used this code:
mysql_query("SELECT user_id FROM blah_table WHERE blah_name = '".$_post['band_name']."' LIMIT 1");
That works as well, but how can I write the script so that it detects the user_id from the other database and deletes other data from other tables? I can enter the table data myself but I do not know how to write the script to detect the user_id to delete from other tables. That way the other commands would be like:
mysql_query("DELETE FROM other_table WHERE user_id= 'USER ID HERE' LIMIT 1");
