Really simple question. I forgot how to deal with this specific script. With a PHP file I create tables in mysql database. I have $query
variable with the following commands:
$query = "CREATE TABLE IF NOT EXISTS `table1` (
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`status` int(11) NOT NULL
)ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `table2` (
`something` varchar(100) NOT NULL,
`whatever` text NOT NULL
)ENGINE=MyISAM DEFAULT CHARSET=utf8;
";
It works only if I exec one single command. When I run multiple CREATE / INSERT / DROP ... commands it doesn't work. For sure there's a mistake with the syntax maybe ; and ,.
mysql_query()
doesn't support multiple statements in the same call.
http://php.net/manual/en/function.mysql-query.php
mysql_query() sends a unique query (multiple queries are not supported) to the currently active database on the server that's associated with the specified link_identifier.