mescal Posted May 1, 2008 Share Posted May 1, 2008 Hi, i try to delete a record in one table if that item is in another table this is my query $query_NOT="DELETE FROM fav_auction fa,bid_auction ba WHERE fa.Lotcode=ba.Lotcode AND fa.client_mail='$client_code'"; but i get a sql error next to where somebody an idea? thx in advance mescal Link to comment https://forums.phpfreaks.com/topic/103699-solved-query-not-working/ Share on other sites More sharing options...
miracle_potential Posted May 1, 2008 Share Posted May 1, 2008 What error are you actually getting? Link to comment https://forums.phpfreaks.com/topic/103699-solved-query-not-working/#findComment-530921 Share on other sites More sharing options...
mescal Posted May 1, 2008 Author Share Posted May 1, 2008 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE fa.Lotcode=ba.Lotcode AND fa.client_mail='[email protected] Link to comment https://forums.phpfreaks.com/topic/103699-solved-query-not-working/#findComment-530922 Share on other sites More sharing options...
miracle_potential Posted May 1, 2008 Share Posted May 1, 2008 $query_NOT="DELETE FROM fav_auction fa,bid_auction ba WHERE fa.Lotcode=ba.Lotcode AND fa.client_mail='" . $client_code . "'"; Try that, you should really separate your variables from your queries Link to comment https://forums.phpfreaks.com/topic/103699-solved-query-not-working/#findComment-530923 Share on other sites More sharing options...
mescal Posted May 1, 2008 Author Share Posted May 1, 2008 still not working ... same error ??? Link to comment https://forums.phpfreaks.com/topic/103699-solved-query-not-working/#findComment-530925 Share on other sites More sharing options...
mescal Posted May 1, 2008 Author Share Posted May 1, 2008 i tried this one but still nothing DELETE * FROM fav_auction LEFT JOIN bid_auction ON fav_auction.Lotcode=bid_auction.Lotcode WHERE fav_auction.client_mail='$client_code'" Link to comment https://forums.phpfreaks.com/topic/103699-solved-query-not-working/#findComment-530942 Share on other sites More sharing options...
miracle_potential Posted May 1, 2008 Share Posted May 1, 2008 Are your field names actually called "ba.Lotcode" and are the capitals in the right place? Its usually something stupid like that Link to comment https://forums.phpfreaks.com/topic/103699-solved-query-not-working/#findComment-530951 Share on other sites More sharing options...
mescal Posted May 1, 2008 Author Share Posted May 1, 2008 DELETE fav_auction FROM fav_auction LEFT JOIN bid_auction ON fav_auction.Lotcode=bid_auction.Lotcode WHERE bid_auction.client_mail='$client_code'" this is working thx alot Link to comment https://forums.phpfreaks.com/topic/103699-solved-query-not-working/#findComment-530957 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.