Home >Backend Development >PHP Tutorial > 小语法有关问题

小语法有关问题

WBOY
WBOYOriginal
2016-06-13 13:28:05779browse

小语法问题

$db=mysql_connect('localhost', 'bp6am', '123') 
or die('Unable to connect.');

$query='CREATE DATABASE IF NOT EXISTS moviesite';
mysql_query($query,$db) or die(mysql_error($db));

mysql_select_db('moviesite',$db) or die(mysql_error($db));

$query='CREATE TABLE movie (
movie_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
movie_name VARCHAR(255) NOT NULL,
movie_type TINYINT NOT NULL DEFAULT 0,
movie_year SMALLINT UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY(movie_id),
KEY movie_type (movie_type,movie_year)
)';
mysql_query($query,$db) or die(mysql_error($db));
?>
然后运行的时候说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 '; )' at line 7

------解决方案--------------------
语法错误、、、你看看你SQL语句吧

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn