homepage Welcome to WebmasterWorld Guest from 23.22.194.120
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
I am getting this error in MySQL
maulin2good




msg:4456291
 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




msg:4456298
 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




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

I fixed that error also thanks :)

rocknbil




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved