Jump to content

Login/Registration Help


Recommended Posts

Okay I am using this tutorial:

http://evolt.org/php_login_script_with_remember_me_feature?

On creating a login/registration page.

The only thing is that it doesn't come with a user id variable, and I would like to know how to add it, in both the PHP coding and the Database, now I believe this is how it should be added to the database:

CREATE TABLE IF NOT EXISTS `users` (
`id` int(10) NOT NULL auto_increment,
`username` varchar(30) NOT NULL default '',
`password` varchar(32) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4;

But im not sure how to add it to the PHP at all.

Now, I have found several other tutorials that have a id variable with it, but none of them allow me to incorporate my pages with it the way I like.

Link to comment
Share on other sites


a few day old question, not all that familiar with php or mysql (is it?) but what the heck.

If that ID field is what I think it is (auto counter which is automatically added for you) then you wouldn't need to set that variable when inserting a new value. Just set the variables for the other two columns and the ID should be added for you. Meaning "Insert into username, password values ('newname', 'newpw')" should be enough.

Or did I miss you question?

Link to comment
Share on other sites

you dont have to specify id when inserting a line.

`id` int(10) NOT NULL auto_increment,

this is the part that creates the data for id. Anytime a new database record is created, MySQL (not PHP) generates a new id number one higher than the whatever the AUTO_INCREMENT value is (which is initially set to 4 in the code you pasted)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...