Hello
I am in the proces of learning php/mysql, i use a book as a learning-source, there is an exercise at the mysql chapter , once i finnish writing the code and execute the php file i get an error and there is nothing in the book about it because , i assume, its an error from my mysql client or something ,
anyway.. this is the code:
Code:
<?php
$connect = mysql_connect ("localhost", "root", "******")
or die ("Unable to connect");
$create = mysql_query ("CREATE DATABASE IF NOT EXISTS moviesite") or
die (mysql_error());
mysql_select_db("moviesite");
$movie = "CREATE TABLE movie (movie_id int(11) NOT NULL auto_increment,
movie_name varchar(255) NOT NULL,
movie_type tinyint(2) NOT NULL default 0,
movie_year int(4) NOT NULL default 0,
movie_leadactor int(11) NOT NULL default 0,
movie_director int(11) NOT NULL default 0,
PRIMARY KEY (movie_id),
KEY movie_type (movie_type,movie_year))";
$results = mysql_query($movie) or
die (mysql_error());
$movietype = "CREATE TABLE movietype (movietype_id int(11) NOT NULL auto_increment,
movietype_label varchar(100) NOT NULL,
PRIMARY KEY (movetype_id):";
$results = mysql_query($movietype) or
die(mysql_error());
$people = "CREATE TABLE people (people_id int(11) NOT NULL auto_inrement,
people_fullname varchar(255) NOT NULL,
people_isactor tinyint(1) NOT NULL default 0,
people_isdirector tinyint(1) NOT NULL default 0,
people_isdirector tinyint(1) NOT NULL default 0,
PRIMARY KEY (people_id))";
$results = mysql_query($people) or
die (mysql_error());
echo "Move DB created !";
?>
this is the error i get when i try to run it:
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 3
specification :
windows xp
running wamp5_1.7.2
MySQL client version: 5.0.37
tho it gives me that error when i check phpmyadmin , i can see that the database does creates with the tabels and fields....
thx in advance !
Last edited by mihai074; 08-25-2007 at 10:11 AM..
|