Xotuako
11-05-2007, 12:43 PM
Hi, I'm learning to code in PHP - and I'm doing very good!
But, something that I don't know is making a mysql database... I don't understand all the pieces, for example:
CREATE TABLE `users` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(30) NOT NULL default '',
`password` varchar(255) NOT NULL default '',
`email` varchar(40) NOT NULL default '',
`msn` varchar(250) NOT NULL default 'Not Specified',
`aim` varchar(250) NOT NULL default 'Not Specified',
`location` varchar(36) NOT NULL default 'Not Specified',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
So, the first part makes a table, called users. I understand that. The id is the users id, it isn't null, so it has to be something, and goes up everytime. What is the int(11)?
Next we have username... not null, so user has to have something, default isn't anything... again, whats this? varchar(30)? I saw somewhere int means you can't have things like - @ etc, and varchar you can have letters numbers - @ etc...
But what are the numbers? On email it's (40) on aim it's (250)... what do they mean, thats all I need to know tbh!
- Thanks and +rep if you can help me! :)
Xotuako
But, something that I don't know is making a mysql database... I don't understand all the pieces, for example:
CREATE TABLE `users` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(30) NOT NULL default '',
`password` varchar(255) NOT NULL default '',
`email` varchar(40) NOT NULL default '',
`msn` varchar(250) NOT NULL default 'Not Specified',
`aim` varchar(250) NOT NULL default 'Not Specified',
`location` varchar(36) NOT NULL default 'Not Specified',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
So, the first part makes a table, called users. I understand that. The id is the users id, it isn't null, so it has to be something, and goes up everytime. What is the int(11)?
Next we have username... not null, so user has to have something, default isn't anything... again, whats this? varchar(30)? I saw somewhere int means you can't have things like - @ etc, and varchar you can have letters numbers - @ etc...
But what are the numbers? On email it's (40) on aim it's (250)... what do they mean, thats all I need to know tbh!
- Thanks and +rep if you can help me! :)
Xotuako