Welcome Guest, Not a member yet? Register   Sign In
[Solved] When Insert New User Get 2 preg_match() errors
#5

[eluser]Tim Brownlaw[/eluser]
Well in this...
Code:
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,

The id is your unique id which would be your user id... There isn't any point in having both...

So you could loose the id and rename it to user_id
Code:
`user_id` int(11) NOT NULL AUTO_INCREMENT,

or just have id as your user id

Code:
`id` int(11) NOT NULL AUTO_INCREMENT,

you'll be using the user_id as a foreign key to any other tables so if you like to have them all the same name across tables use user_id as your primary key

Code:
CREATE TABLE IF NOT EXISTS `users` (
  `user_id` int(11) NOT NULL AUTO_INCREMENT,
  `ip` varchar(45) NOT NULL,
  `firstname` varchar(255) NOT NULL,
  `lastname` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `country` varchar(255) NOT NULL,
  `joined_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`user_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

So you don't need to have an id and a user_id... Choose one or the other!

Cheers
Tim


Messages In This Thread
[Solved] When Insert New User Get 2 preg_match() errors - by El Forum - 04-28-2014, 06:02 AM
[Solved] When Insert New User Get 2 preg_match() errors - by El Forum - 04-28-2014, 08:02 AM
[Solved] When Insert New User Get 2 preg_match() errors - by El Forum - 04-28-2014, 11:40 PM
[Solved] When Insert New User Get 2 preg_match() errors - by El Forum - 04-28-2014, 11:52 PM
[Solved] When Insert New User Get 2 preg_match() errors - by El Forum - 04-29-2014, 12:09 AM
[Solved] When Insert New User Get 2 preg_match() errors - by El Forum - 04-29-2014, 12:16 AM
[Solved] When Insert New User Get 2 preg_match() errors - by El Forum - 04-29-2014, 01:27 AM
[Solved] When Insert New User Get 2 preg_match() errors - by El Forum - 04-29-2014, 07:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB