1
我有一個由PHPMyAdmin生成的MySQL CREATE TABLE腳本。它直接並通過PHPMyAdmin工作得很好,但我無法通過我的PHP腳本獲取它。MySQL'CREATE TABLE'查詢直接並通過PHPMyAdmin工作,但不通過PHP
我得到的錯誤是:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
'CREATE TABLE IF NOT EXISTS `vc5_users` (`id` int(12) NOT NULL AUTO' at line 14
這裏的查詢:
INSERT INTO `users` (fname, lname, email, username, password, books_available, users_available, signup_date)
VALUES (
'John',
'Doe',
'[email protected]',
'jdoe',
'foobar',
'250',
'25',
'123456'
);
CREATE TABLE IF NOT EXISTS `jdoe_users` (
`id` int(12) NOT NULL AUTO_INCREMENT,
`fname` varchar(128) COLLATE utf8_bin NOT NULL,
`created_at` varchar(32) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `jdoe_books` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`isbn` varchar(13) NOT NULL,
`title` varchar(256) NOT NULL,
`author` varchar(256) NOT NULL,
`publisher` varchar(128) NOT NULL,
`status` varchar(32) NOT NULL,
`last_loan` date NOT NULL,
`last_return` date NOT NULL,
`bookholder` varchar(64) NOT NULL,
`due_back` date NOT NULL,
`quantity` int(11) NOT NULL DEFAULT '1',
`thumnail_url` varchar(128) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
謝謝,我很習慣PDO MySQL;) – narruc