Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 08-23-2007, 12:07 PM MySql weird error [Fixed]
mihai074's Avatar
Experienced Talker

Posts: 36
Trades: 0
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..
mihai074 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-23-2007, 12:32 PM Re: MySql weird error
Skilled Talker

Posts: 94
Trades: 0
Code:
									  PRIMARY KEY (movetype_id);";
The error is telling you that it didn't expect the Colon (

Replace it with a semi-colon ( as I did above
__________________
Sell Templates? Try our
Please login or register to view this content. Registration is FREE
! See a live
Please login or register to view this content. Registration is FREE
ChadR is offline
Reply With Quote
View Public Profile
 
Old 08-23-2007, 12:45 PM Re: MySql weird error
Super Talker

Posts: 134
Trades: 0
Quote:
$movietype = "CREATE TABLE movietype (movietype_id int(11) NOT NULL auto_increment,
movietype_label varchar(100) NOT NULL,
PRIMARY KEY (movetype_id):";
has to (movietype))"



__________________

Please login or register to view this content. Registration is FREE

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
Old 08-23-2007, 01:19 PM Re: MySql weird error
Skilled Talker

Posts: 94
Trades: 0
woah double catch very nice!
__________________
Sell Templates? Try our
Please login or register to view this content. Registration is FREE
! See a live
Please login or register to view this content. Registration is FREE
ChadR is offline
Reply With Quote
View Public Profile
 
Old 08-23-2007, 08:17 PM Re: MySql weird error
mihai074's Avatar
Experienced Talker

Posts: 36
Trades: 0
Cheers lads! It works fine now.

I can sware i looked over the code a couple of times for mistakes , guess i do not have that coder-spelling-sence developed yet !
mihai074 is offline
Reply With Quote
View Public Profile
 
Old 08-25-2007, 08:42 AM Re: MySql weird error
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
i wish i had edit rights on here all i would do is be the annouying person who would edit peoples post and put code in [*code*] and [*php*] (without the *) brackets

im wierd like that... sorry this dont contribute anything to this thread
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Reply     « Reply to MySql weird error
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28910 seconds with 12 queries