Final Fantasy Republic Forums  
 Home | Forums | Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
     
    
        
     
 
Final Fantasy Republic Forums  
Username:

Password:
CAPTCHA:
  
        
Closed Thread
 
LinkBack Thread Tools Display Modes
  Pocketx
 
 
Pocketx's Avatar
Registered User
 
Posts: 966
 
Reg: Jul 31 2002
 
ID: 1634
 
RP: 0
 
NBA 2k Series
Eminem
8 Mile, Rush Hour Series
Dreamcast
     
 
Default  Help with mySQL tables
01.12.03, 19:21:16
  Post #1 (permalink)
 
     

Erm, im making my users system for my site but i got errors while working with these tables:

PHP Code:
CREATE TABLE session 
id int(14NOT NULL auto_increment
sessionid varchar(255NOT NULL default ''
username varchar(20NOT NULL default ''
auth int(14NOT NULL default '0'
userid int(14NOT NULL default '0'
firstname varchar(50NOT NULL default ''
lastname varchar(50NOT NULL default ''
PRIMARY KEY (id
); 
and

PHP Code:
CREATE TABLE `comments` ( 
`
idINT(14NOT NULL AUTO_INCREMENT PRIMARY KEY
`
newsidINT NOT NULL 
`useridINT(14NOT NULL
`
commentTEXT NOT NULL
`
dateTIMESTAMP NOT NULL 
); 
What am i doing wrong?
  Pocketx is offline
View Pocketxs Profile! Find more posts by Pocketx! Visit Pocketxs Homepage!  
  Pocketx
 
 
Pocketx's Avatar
Registered User
 
Posts: 966
 
Reg: Jul 31 2002
 
ID: 1634
 
RP: 0
 
NBA 2k Series
Eminem
8 Mile, Rush Hour Series
Dreamcast
     
 
Default  01.14.03, 17:05:16
  Post #2 (permalink)
 
     

Please, anyone?
  Pocketx is offline
View Pocketxs Profile! Find more posts by Pocketx! Visit Pocketxs Homepage!  
  Shift
 
 
Shift's Avatar
uniku3.on3
 
Posts: 820
 
Reg: Apr 17 2002
 
ID: 553
 
RP: 250
 
WoW
ABK
Akira
Eh.
PC
     
 
Default  01.15.03, 07:22:15
  Post #3 (permalink)
 
     

Hmm, I don't really see any error in your syntax, you might ask rake what is wrong. BTW how about you show us the error that it's outputting. I'll talk to rake on AIM and get him to come over here.

-Shift
______________________________________

Send a message via AIM to Shift Send a message via MSN to Shift Send a message via Yahoo to Shift   Shift is offline
View Shifts Profile! Find more posts by Shift! Visit Shifts Homepage!  
  rake
 
 
rake's Avatar
Sorceror|Supreme
 
Posts: 1,269
 
Reg: Jan 15 2002
 
ID: 4
 
RP: 0
 
None
None
None
None
     
 
Default  01.15.03, 08:27:42
  Post #4 (permalink)
 
     

use this rather than the code for the first table.


CREATE TABLE `session` (
`id` INT( 14 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`sessionid` VARCHAR( 255 ) NOT NULL ,
`username` VARCHAR( 20 ) NOT NULL ,
`auth` INT( 14 ) NOT NULL ,
`userid` INT( 14 ) NOT NULL ,
`firstname` VARCHAR( 50 ) NOT NULL ,
`lastname` VARCHAR( 50 ) NOT NULL
);

As for the second, i only see a missing comma after line 3.
______________________________________


Send a message via ICQ to rake Send a message via AIM to rake   rake is offline
View rakes Profile! Find more posts by rake! Visit rakes Homepage!  
  Crater Seraph
 
 
Crater Seraph's Avatar
slapstickhumor
 
Posts: 2,780
 
Reg: Mar 26 2002
 
ID: 363
 
RP: 100000
 
Final Fantasy VIII
djFirespade
Waiting
N/A
PlayStation
     
 
Default  Re: Help with mySQL tables
01.15.03, 08:52:49
  Post #5 (permalink)
 
     

Well, first off, all these unneccesary defaults need to go. Your first should look like....

Quote:
CREATE TABLE `session` (
`id` int(14) NOT NULL auto_increment,
`sessionid` varchar(255) NOT NULL,
`username` varchar(20) NOT NULL,
`auth` int(14) NOT NULL default '0',
`userid` int(14) NOT NULL default '0',
`firstname` varchar(50) NOT NULL,
`lastname` varchar(50) NOT NULL,
PRIMARY KEY (id)
);
Second....

Quote:
CREATE TABLE`comments` (
`id` INT(14) NOT NULL auto increment,
`newsid` INT NOT NULL,
`userid` INT(14) NOT NULL,
`comment` TEXT NOT NULL,
`date` TIMESTAMP NOT NULL,
PRIMARY KEY (id)
);
Also, you forgot back-ticks. How are you processing these queries?

______________________________________


Last edited by shovel : 01.15.03 at 08:55:55.
Send a message via AIM to Crater Seraph   Crater Seraph is offline
View Crater Seraphs Profile! Find more posts by Crater Seraph! Visit Crater Seraphs Homepage!  
  Shift
 
 
Shift's Avatar
uniku3.on3
 
Posts: 820
 
Reg: Apr 17 2002
 
ID: 553
 
RP: 250
 
WoW
ABK
Akira
Eh.
PC
     
 
Default  01.15.03, 09:15:30
  Post #6 (permalink)
 
     

Hmm, I'd like to know how to do that in the first place >_<


I'll talk to rake or Anthony about how you can add stuff to the SQL with just a form xD I'll need that soon for a 'project'

-Shift
Send a message via AIM to Shift Send a message via MSN to Shift Send a message via Yahoo to Shift   Shift is offline
View Shifts Profile! Find more posts by Shift! Visit Shifts Homepage!  
  Pocketx
 
 
Pocketx's Avatar
Registered User
 
Posts: 966
 
Reg: Jul 31 2002
 
ID: 1634
 
RP: 0
 
NBA 2k Series
Eminem
8 Mile, Rush Hour Series
Dreamcast
     
 
Default  Re: Re: Help with mySQL tables
01.15.03, 11:05:12
  Post #7 (permalink)
 
     

Quote:
Originally posted by ArtoFreeze
Well, first off, all these unneccesary defaults need to go. Your first should look like....



Second....



Also, you forgot back-ticks. How are you processing these queries?


Thanks to u and rake!

Im using phpmyadmin
  Pocketx is offline
View Pocketxs Profile! Find more posts by Pocketx! Visit Pocketxs Homepage!  
  Crater Seraph
 
 
Crater Seraph's Avatar
slapstickhumor
 
Posts: 2,780
 
Reg: Mar 26 2002
 
ID: 363
 
RP: 100000
 
Final Fantasy VIII
djFirespade
Waiting
N/A
PlayStation
     
 
Default  01.15.03, 15:37:33
  Post #8 (permalink)
 
     

Ok. Then, yeah, you'll need the back-ticks. Inserting queries through PHP directly can be a bit weird. I'm glad you're using phpMyAdmin, it's reliable.
Send a message via AIM to Crater Seraph   Crater Seraph is offline
View Crater Seraphs Profile! Find more posts by Crater Seraph! Visit Crater Seraphs Homepage!  
  Pocketx
 
 
Pocketx's Avatar
Registered User
 
Posts: 966
 
Reg: Jul 31 2002
 
ID: 1634
 
RP: 0
 
NBA 2k Series
Eminem
8 Mile, Rush Hour Series
Dreamcast
     
 
Default  01.15.03, 16:54:33
  Post #9 (permalink)
 
     

Yup, phpmyadmin, is defeniftly the best mySQL management ever!
  Pocketx is offline
View Pocketxs Profile! Find more posts by Pocketx! Visit Pocketxs Homepage!