I've been going round and round trying to sort this.
I have this in one of my programs:
drop table if exists temp2; rename table something to temp2; rename table temp to something; create table temp like something
and it's not working, though it will work when I manually paste it into the sql box on phpMyadmin
The problem is probably the first line: "drop table..." requires a confirmation, but as the program concerned is a cron job run once a day at 3am (to update a site), this is not available. I haven't been able to find any workaround despite lengthy searching. So I'm reduced to manually running these commands every morning, making the update late (which is probably not all that serious, but is a pain in the ass).