CodeIgniter Forums
how to check is the username available? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: how to check is the username available? (/showthread.php?tid=20936)



how to check is the username available? - El Forum - 07-26-2009

[eluser]miauksius[/eluser]
Howdy,

When I was programing regular PHP, I was storing all data to txt files, and now, when I'm starting to use CI, I must use mysql. Can you please tell me, how to check username availability? That would help me to create the callback function for form validation.

THANK YOU

P.S. Sorry for the broken english


how to check is the username available? - El Forum - 07-26-2009

[eluser]wowdezign[/eluser]
[quote author="miauksius" date="1248631713"]
now, when I'm starting to use CI, I must use mysql.
[/quote]

You mean you are required to use MySQL because of CodeIgniter or because of someone (or something) else?


how to check is the username available? - El Forum - 07-26-2009

[eluser]miauksius[/eluser]
Because sooner or later I would have to use mysql, and CI was the reason to start that sooner. Besides, it's so easy with CI Smile


how to check is the username available? - El Forum - 07-26-2009

[eluser]mimran[/eluser]
HI
I guess simplest logic is you will be storing a username in a user table. So when someone is signing up and they ask for a username just check against all the usernames' in the table you already have, if it is not there that means it is available.

good luck


how to check is the username available? - El Forum - 07-26-2009

[eluser]miauksius[/eluser]
Yes yes yes, I understand that, but how should the query look like, and how can I handle it?


how to check is the username available? - El Forum - 07-26-2009

[eluser]miauksius[/eluser]
Problem solved