Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   username validation in php (http://www.go4expert.com/forums/username-validation-php-t9733/)

pinku 3Apr2008 12:30

username validation in php

lI am new to php coding. I'd need some help...im setting up a username/password system and need to be able to check whether a new username is unique. I have tired....can u help me?

mufaddal zirapurwala 17Apr2008 11:06

Re: username validation in php
U can do this by just a select query here is the solution

$query = "SELECT * FROM UserTable WHERE username=".$_Post['username'];
$Con = mysql_query($query, $connection) or die(mysql_error());
$row = mysql_fetch_assoc($Con);
$totalRows = mysql_num_rows($Con);

echo 'Username exist';
echo 'Unique Username';

hope this code can help

All times are GMT +5.5. The time now is 21:20.