Welcome to WebmasterWorld Guest from 54.226.189.112

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

I am getting this error in MySQL

     

maulin2good

7:40 am on May 22, 2012 (gmt 0)





#1064 - 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 4



CREATE TABLE motion
(
img varchar(30),
);



maulin2good

7:49 am on May 22, 2012 (gmt 0)



I fixed the above problem but now i m getting another 1:

#1064 - 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 'Database ( img char(100), img2 char(100), img3 char(100), url char(100), url2 ch' at line 1

CREATE TABLE Movie Database 
(
img char(100),
img2 char(100),
img3 char(100),
url char(100),
url2 char(100),
url3 char(100),
movie char(100),
movie2 char(100),
movie3 char(100)
);

maulin2good

7:50 am on May 22, 2012 (gmt 0)



I fixed that error also thanks :)

rocknbil

4:50 pm on May 22, 2012 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Yeah MOVIE DATABASE has spaces, without the word movie, DATABASE is a reserved word, in both cases it requires backticks . . . .

Whoah there cowboy. :-) You are starting off on the wrong foot. You're creating a database that limits to 3. What happens if you want 4? Even if you don't, this makes for a wide table and it's pretty inefficient. Also char is probably not the right type (is's just a-z,) you probably want varchar.

You should REALLY do this as a relational table. Look at this example:

table users
id|username|fname|lname| (etc.)

table movies
id|userid|moviename|url|img

You can have an unlimited number of movie entries (which you can limit with your programming.) It's not all that complicated either . . .

select users.fname,users.lname,movies.moviename,movies.url,movies.img from users,movies where users.id=movies.userid order by moviename limit 5;

Back up and make sure you're building your house on a solid foundation, it's not so easy to fix these things later, especially if you build a lot of programming on top of it.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month