Forum Moderators: coopster

Message Too Old, No Replies

Whats wrong with this MySQL table data?

         

JAB Creations

12:59 am on Apr 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



PHPMyAdmin keeps making PASSWORD and NOW red though I have no clue for what reason. I'm totally new to mysql so please try to keep the jargin to a min. ^.^

INSERT INTO users VALUES (NULL 'bob', 'smith', 'bobsmith@example.com', PASSWORD('bobsmith'), NOW());

JAB Creations

1:23 am on Apr 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nevermind my bad ... I was trying to add a username when there was no username field in the DB. I've got it working nicely now and it makes sense which is a sweet bonus!

coopster

11:39 am on Apr 16, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Syntax-wise it also looks as if you are missing a comma after that first NULL value too.

You could always list your columns rather than use the relative syntax too.

INSERT INTO users 
(id, firstname, lastname, username, userpass, userdate)
VALUES
(NULL, 'bob', 'smith', 'bobsmith@example.com', PASSWORD('bobsmith'), NOW());

Don't forget that if you do not specify the column list for INSERT ... VALUES, values for every column in the table must be provided in the VALUES() list. If you don't know the order of the columns in the table, use "DESCRIBE users" to find out.