| |
|
|
| |
|
|
| |
|
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(14) NOT NULL auto_increment,
sessionid varchar(255) NOT NULL default '',
username varchar(20) NOT NULL default '',
auth int(14) NOT NULL default '0',
userid int(14) NOT NULL default '0',
firstname varchar(50) NOT NULL default '',
lastname varchar(50) NOT NULL default '',
PRIMARY KEY (id)
);
and
PHP Code:
CREATE TABLE `comments` (
`id` INT(14) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`newsid` INT NOT NULL
`userid` INT(14) NOT NULL,
`comment` TEXT NOT NULL,
`date` TIMESTAMP NOT NULL
);
What am i doing wrong? |
|
|
|
|
|
|
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 |
______________________________________
|
|
|
|
|
|
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. |
______________________________________

|
|
|
|
|
|
| |
|
|
| |
|
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.
|
|
|
|
|
|
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 |
|
|
|
|
|
|
| |
|
|
| |
|
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 |
|
|
|
|
|
|
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.  |
|
|
|
|
|
|
| Yup, phpmyadmin, is defeniftly the best mySQL management ever! |
|
|
|
|
| |