drbigfresh Posted October 28, 2007 Share Posted October 28, 2007 Is there anyway to make something like this work: $SQL = $SQL . "delete from e_user where id=" . $DeleteID . "\n"; $SQL = $SQL . "delete from upload where uid=" . $DeleteID . "\n"; $SQL = $SQL . "delete from e_workexperience where uid=" . $DeleteID . "\n"; $SQL = $SQL . "delete from e_schooling where uid=" . $DeleteID . "\n"; $SQL = $SQL . "delete from e_notes where uid=" . $DeleteID . "\n"; $SQL = $SQL . "delete from e_miscuserdata where uid=" . $DeleteID . "\n"; $SQL = $SQL . "delete from e_industryexperiencemap where uid=" . $DeleteID . "\n"; $db->Execute($SQL) or die("Error in query: $query. " . $db->ErrorMsg()); Quote Link to comment https://forums.phpfreaks.com/topic/75143-multi-line-queries/ Share on other sites More sharing options...
teng84 Posted October 28, 2007 Share Posted October 28, 2007 ignore Quote Link to comment https://forums.phpfreaks.com/topic/75143-multi-line-queries/#findComment-380035 Share on other sites More sharing options...
drbigfresh Posted October 28, 2007 Author Share Posted October 28, 2007 Aren't I making a really long query separated by new lines since it's $SQL = $SQL . "" ? I know it doesn't work, but is there a way to make it work or do I have to execute each query separately? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/75143-multi-line-queries/#findComment-380044 Share on other sites More sharing options...
teng84 Posted October 28, 2007 Share Posted October 28, 2007 join your tables eg.. delete from table1,table2 where table1field = table2field etc.... and id = teng Quote Link to comment https://forums.phpfreaks.com/topic/75143-multi-line-queries/#findComment-380047 Share on other sites More sharing options...
trq Posted October 29, 2007 Share Posted October 29, 2007 Aren't I making a really long query separated by new lines since it's $SQL = $SQL . "" ? Queries are seperated by colons ; in sql. Having said that however, the mysql extension does not support the execution of multiple queries (seperated by ; for security reasons. You will need to place all your queries within an array, loop through the array and execute each query. Quote Link to comment https://forums.phpfreaks.com/topic/75143-multi-line-queries/#findComment-380087 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.