It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum

database tables

Moderator: Malcolm

database tables

Postby joshcxa on Mon Sep 26, 2005 12:10 pm

I can't seem to work out how to create tables.

CREATE TABLE `databasename`.`cmsarticles` (
`ID` int(6) unsigned NOT NULL auto_increment COMMENT 'The unique ID of the article',
`title` varchar(200) NULL COMMENT 'The article title',
`tagline` varchar(255) NULL COMMENT 'Short summary of the article',
`section` int(4) NULL DEFAULT 0 COMMENT 'The section of the article',
`thearticle` text NULL COMMENT 'The article itself',
PRIMARY KEY (`ID`)
);

I'm following a tutorial that uses this to a create a table and i'm not sure how to go about it. I can't do it in phpMyAdmin because some of the options aren't in the table maker. I'll screen shot if you want.

How do I create the table from the browser?
joshcxa
DEVPPL Lightwave Moderator
User avatar
joshcxa
100+ Club
 
Posts: 156
Joined: Wed Aug 18, 2004 10:59 am
Location: Australia

Postby webmaster on Mon Sep 26, 2005 1:16 pm

If you use phpMyAdmin, just press SQL and then add this code in the textarea and press OK =)
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby joshcxa on Mon Sep 26, 2005 1:36 pm

yeah i did that just after i wrote this...now i get an error

#1064 - You have an error in your SQL syntax near 'COMMENT 'The unique ID of the article',
`title` varchar(200) NULL COMMENT 'The ' at line 2

------------------------------------------------

This is what i put in the query


CREATE TABLE `mydbname`.`cmsarticles` (
`ID` int( 6 ) unsigned NOT NULL AUTO_INCREMENT COMMENT 'The unique ID of the article',
`title` varchar( 200 ) NULL COMMENT 'The article title',
`tagline` varchar( 255 ) NULL COMMENT 'Short summary of the article',
`section` int( 4 ) NULL DEFAULT 0 COMMENT 'The section of the article',
`thearticle` text NULL COMMENT 'The article itself',
PRIMARY KEY ( `ID` )
)
joshcxa
DEVPPL Lightwave Moderator
User avatar
joshcxa
100+ Club
 
Posts: 156
Joined: Wed Aug 18, 2004 10:59 am
Location: Australia

Postby webmaster on Mon Sep 26, 2005 2:03 pm

Try this:

Code: Select all
CREATE TABLE `mydbname` (
`ID` int( 6 ) unsigned NOT NULL AUTO_INCREMENT COMMENT 'The unique ID of the article',
`title` varchar( 200 ) NULL COMMENT 'The article title',
`tagline` varchar( 255 ) NULL COMMENT 'Short summary of the article',
`section` int( 4 ) NULL DEFAULT 0 COMMENT 'The section of the article',
`thearticle` text NULL COMMENT 'The article itself',
PRIMARY KEY ( `ID` )
)
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby joshcxa on Mon Sep 26, 2005 2:09 pm

nope didn't work

Image
joshcxa
DEVPPL Lightwave Moderator
User avatar
joshcxa
100+ Club
 
Posts: 156
Joined: Wed Aug 18, 2004 10:59 am
Location: Australia

Postby webmaster on Mon Sep 26, 2005 2:19 pm

Have you tried using the axact same code as I sent you, that one works fine for me
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby joshcxa on Mon Sep 26, 2005 2:22 pm

yep...exactly

check out the image to see what i did
joshcxa
DEVPPL Lightwave Moderator
User avatar
joshcxa
100+ Club
 
Posts: 156
Joined: Wed Aug 18, 2004 10:59 am
Location: Australia

Postby webmaster on Mon Sep 26, 2005 7:46 pm

I saw a change of the tablename in the image, so I thought you meight had changed anything else. Try this then:

Code: Select all
CREATE TABLE `mydbname` (
  `ID` int(6) unsigned NOT NULL auto_increment,
  `title` varchar(200) default NULL,
  `tagline` varchar(255) default NULL,
  `section` int(4) default '0',
  `thearticle` text,
  PRIMARY KEY  (`ID`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby joshcxa on Tue Sep 27, 2005 2:02 am

Ah good stuff that worked.
can i still chuck the descriptions in?

what does TYPE=MyISAM AUTO_INCREMENT=1 ; do?
joshcxa
DEVPPL Lightwave Moderator
User avatar
joshcxa
100+ Club
 
Posts: 156
Joined: Wed Aug 18, 2004 10:59 am
Location: Australia

Postby joshcxa on Tue Sep 27, 2005 2:57 am

Also, I have an error message on ym db main page.
Its says:

Error
The additional Features for working with linked Tables have been deactivated. To find out why click here.

What does this mean?
joshcxa
DEVPPL Lightwave Moderator
User avatar
joshcxa
100+ Club
 
Posts: 156
Joined: Wed Aug 18, 2004 10:59 am
Location: Australia

Next

Who is online

Users browsing this forum: No registered users and 0 guests