Multiple MySQL Statements
Posted: Sat Aug 23, 2003 5:11 pm
I was wondering if there was any way to run multiple mysql statements through mysql_query(). Here's some code:
I just get the error
ERROR NUMBER: 1064
ERROR MESSAGE: You have an error in your SQL syntax near ';
CREATE TABLE `rp_auth_access` ( `group_id` mediumint(8) NOT NULL defau' at line 2
I know that the reason is because it deals with multiple statements because I can put 1 statement from above in and it works fine, but if I put 2 then I get the error.
Thanks to anyone that can help.
Code: Select all
<?php
$mysqlQuery = "DROP TABLE IF EXISTS `" . $dir . "_auth_access`;
CREATE TABLE `" . $dir . "_auth_access` (
`group_id` mediumint(8) NOT NULL default '0',
`forum_id` smallint(5) unsigned NOT NULL default '0',
`auth_view` tinyint(1) NOT NULL default '0',
`auth_read` tinyint(1) NOT NULL default '0',
`auth_post` tinyint(1) NOT NULL default '0',
`auth_reply` tinyint(1) NOT NULL default '0',
`auth_edit` tinyint(1) NOT NULL default '0',
`auth_delete` tinyint(1) NOT NULL default '0',
`auth_sticky` tinyint(1) NOT NULL default '0',
`auth_announce` tinyint(1) NOT NULL default '0',
`auth_vote` tinyint(1) NOT NULL default '0',
`auth_pollcreate` tinyint(1) NOT NULL default '0',
`auth_attachments` tinyint(1) NOT NULL default '0',
`auth_mod` tinyint(1) NOT NULL default '0',
KEY `group_id` (`group_id`),
KEY `forum_id` (`forum_id`)
) TYPE=MyISAM;";
$mysqlQueryResult = mysql_query($mysqlQuery);
?>ERROR NUMBER: 1064
ERROR MESSAGE: You have an error in your SQL syntax near ';
CREATE TABLE `rp_auth_access` ( `group_id` mediumint(8) NOT NULL defau' at line 2
I know that the reason is because it deals with multiple statements because I can put 1 statement from above in and it works fine, but if I put 2 then I get the error.
Thanks to anyone that can help.