user registration help
Moderator: General Moderators
- flying_circus
- Forum Regular
- Posts: 732
- Joined: Wed Mar 05, 2008 10:23 pm
- Location: Sunriver, OR
Re: user registration help
What have you tried to fix the problem?
Re: user registration help
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:
Thanks........
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′));
Re: user registration help
Code: Select all
INSERT INTO user_auth (column1, column2, column3) VALUES ('column1val', 'column2val', 'column3val')-
rlthompson
- Forum Newbie
- Posts: 13
- Joined: Sun Mar 21, 2010 1:59 pm
Re: user registration help
I got it, thanks to everyone for the very helpful tips.