Good evening everyone! Created two tables in a MySQL database using phpmyadmin and chose export to create a SQL query. Having executed this SQL query in phpmyadmin, everything works, but does not work in its code, it shows an error:

You have an error in your SQL syntax; m_quick_polls to the right place.

code :

 mysql_query(" CREATE TABLE IF NOT EXISTS `m_quick_polls` ( `pid` int(11) NOT NULL AUTO_INCREMENT, `quest` text CHARACTER SET latin1 NOT NULL, `tansw` varchar(3) CHARACTER SET latin1 NOT NULL DEFAULT 'one', UNIQUE KEY `pid` (`pid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `m_quick_polls_vnts` ( `vnt_id` int(11) NOT NULL AUTO_INCREMENT, `poll_id` int(11) NOT NULL, `title` text NOT NULL, `cnts` int(11) NOT NULL, UNIQUE KEY `vnt_id` (`vnt_id`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ;"); echo mysql_error(); 

If divided into two requests, it sometimes works. Part of the code for connection, choice of base lowered, the right to write is, there are no bases, words were not reserved. Already to stupor, apparently I reworked today, and my head is not thinking, I appeal to you for help.

    1 answer 1

    The mysql extension does not allow you to execute multiple queries at once. Break the query into two and execute them separately. Or read about mysqli .

    • Thank you very much, perhaps I will go to sleep, that's enough for today. ) - Andrey Arshinov