acctman Posted February 22, 2009 Share Posted February 22, 2009 does this look functional, and can i be similfied? function delete_record($id) { $user = mysql_result(mysql_query("SELECT m_user FROM rate_members WHERE m_id=$id"), 0, "m_user"); $date = mysql_result(mysql_query("SELECT m_date FROM rate_members WHERE m_id=$id"), 0, "m_date"); usr_del_dir("/home/rimgs/public_html/" . date("Y", $date) . "/" . date("m", $date) . "/" . $id . "/"); //remove db entries mysql_query("DELETE FROM chat_plugin_history WHERE from_user=$user"); mysql_query("DELETE FROM rate_blogs WHERE b_user=$id"); mysql_query("DELETE FROM rate_favourites WHERE f_user=$id"); mysql_query("DELETE FROM rate_favourites WHERE f_fav=$id"); mysql_query("DELETE FROM rate_members WHERE m_id=$id"); mysql_query("DELETE FROM rate_members_ban WHERE b_owner=$id"); mysql_query("DELETE FROM rate_members_ban WHERE b_banned=$id"); mysql_query("DELETE FROM rate_messages WHERE msg_sender=$id"); mysql_query("DELETE FROM rate_messages WHERE msg_recip=$id"); mysql_query("DELETE FROM rate_mobile_pics WHERE mob_user=$id"); mysql_query("DELETE FROM rate_mp3s WHERE mp3_userid=$id"); mysql_query("DELETE FROM rate_phones WHERE ph_user=$id"); mysql_query("DELETE FROM rate_pictures WHERE i_user=$id"); mysql_query("DELETE FROM rate_pictures_comments WHERE com_for=$id"); mysql_query("DELETE FROM rate_pictures_comments WHERE com_user=$id"); mysql_query("DELETE FROM rate_private WHERE p_from=$id"); mysql_query("DELETE FROM rate_private WHERE p_to=$id"); mysql_query("DELETE FROM rate_profile_views WHERE v_for=$id"); mysql_query("DELETE FROM rate_ratings WHERE r_for=$id"); mysql_query("DELETE FROM rate_referrals WHERE ref_by=$id"); } Quote Link to comment https://forums.phpfreaks.com/topic/146427-solved-double-check-my-queries-please/ Share on other sites More sharing options...
corbin Posted February 23, 2009 Share Posted February 23, 2009 If you plan on using InnoDB you could use a foreign key with an ON DELETE thing. I think that's possible in MySQL.... I'm 99.9999999999% sure it is, but I just pulled that number from the air. Quote Link to comment https://forums.phpfreaks.com/topic/146427-solved-double-check-my-queries-please/#findComment-768878 Share on other sites More sharing options...
acctman Posted February 23, 2009 Author Share Posted February 23, 2009 the first two queries look good though right? Quote Link to comment https://forums.phpfreaks.com/topic/146427-solved-double-check-my-queries-please/#findComment-768926 Share on other sites More sharing options...
fenway Posted February 23, 2009 Share Posted February 23, 2009 the first two queries look good though right? What does that even mean? Syntactially, they're fine, but that doesn't mean that they run on the correct data. You can use "LIMIT 0" to check syntax. Quote Link to comment https://forums.phpfreaks.com/topic/146427-solved-double-check-my-queries-please/#findComment-769062 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.