FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Database =/





Manntis
I was creating my database in SQL and I have no idea what I am doing...



CREATE TABLE users (
userid int(25) NOT NULL auto_increment,
name varchar(25) NOT NULL default '',
email varchar(255) NOT NULL default '',
username varchar(25) NOT NULL default '',
password varchar(255) NOT NULL default '',
PRIMARY KEY (userid),
UNIQUE KEY username (username)
) TYPE=MyISAM COMMENT='Members';



For the default in mySQL what do I put in that box? Do I put ''?
Star Wars Fanatic
Well default just means that if you create a new row without any information in that column it will contain the default value.

Say you did this...

Code:
CREATE TABLE users (
userid int(25) NOT NULL auto_increment,
name varchar(25) NOT NULL default 'NoName',
email varchar(255) NOT NULL default '',
username varchar(25) NOT NULL default '',
password varchar(255) NOT NULL default '',
PRIMARY KEY (userid),
UNIQUE KEY username (username)
) TYPE=MyISAM COMMENT='Members';


Then when you create a new row and don't set anything to name, it will be saved as "NoName."

You can also just forget the default, as you don't want to have a user that doesn't have a name, email, or password...

Code:
CREATE TABLE users (
userid int(25) NOT NULL auto_increment,
name varchar(25) NOT NULL,
email varchar(255) NOT NULL,
username varchar(25) NOT NULL,
password varchar(255) NOT NULL,
PRIMARY KEY (userid),
UNIQUE KEY username (username)
) TYPE=MyISAM COMMENT='Members';


You also probably want to have userid set as Primary...
Manntis
Okay much thanks.
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.