Page 2 of 2

Re: user registration help

Posted: Sun Mar 28, 2010 8:33 pm
by flying_circus
What have you tried to fix the problem?

Re: user registration help

Posted: Sun Mar 28, 2010 10:45 pm
by khuzema
hi

You may think that you would store an IP address as a VARCHAR(15) field and you could, but this is not the most efficient way to store IPs. Instead you could use an INT. please remember though that you must use an INT UNSIGNED or IPs with the first octet higher than 127 will not be stored properly.

To use an INT field you must convert the IP address to numbers as you cannot store the periods in an INT field. To do this we use a MySQL command called INET_ATON(). All you need to do is provide an IP address and it will be converted to a numeric value. The IP address may be a 32-bit or 128-bit addresses.

An example command might be this:

Code: Select all

INSERT INTO user_auth(remote_addr) VALUES(INET_ATON(‘127.0.0.1′));
Thanks........

Re: user registration help

Posted: Mon Mar 29, 2010 9:40 am
by Sephern

Code: Select all

INSERT INTO user_auth (column1, column2, column3) VALUES ('column1val', 'column2val', 'column3val')
If you're getting any SQL errors, I just check the w3 site to check that I'm writing it correctly. ;x

Re: user registration help

Posted: Mon Mar 29, 2010 6:20 pm
by rlthompson
I got it, thanks to everyone for the very helpful tips.