Hi
Im trying to create a function that tests if a 'Username' exists in a
particular table. If the value is found then the code generates 'Username1'
as the username, and check if that username exists. If it does, it
continues onto generating 'Username2' and so on.
<?
//testing with username andrew
$name = "andrew";
mysql_pconnect( "server", "username", "pass");
mysql_select_db ("db");
$result = mysql_query("SE LECT Username FROM users WHERE Username =
'$name'");
$num_rows = mysql_num_rows( $result);
if ($num_rows > 0):
$count = 1;
While ($num_rows > 0):
//$username = $username.$coun t;
$result = mysql_query("SE LECT Username FROM users WHERE Username =
'$name'");
$num_rows = mysql_num_rows( $result);
print($username .$count);
$count = $count + 1;
endwhile;
//----
else:
print("ok");
endif;
?>
Im trying to create a function that tests if a 'Username' exists in a
particular table. If the value is found then the code generates 'Username1'
as the username, and check if that username exists. If it does, it
continues onto generating 'Username2' and so on.
<?
//testing with username andrew
$name = "andrew";
mysql_pconnect( "server", "username", "pass");
mysql_select_db ("db");
$result = mysql_query("SE LECT Username FROM users WHERE Username =
'$name'");
$num_rows = mysql_num_rows( $result);
if ($num_rows > 0):
$count = 1;
While ($num_rows > 0):
//$username = $username.$coun t;
$result = mysql_query("SE LECT Username FROM users WHERE Username =
'$name'");
$num_rows = mysql_num_rows( $result);
print($username .$count);
$count = $count + 1;
endwhile;
//----
else:
print("ok");
endif;
?>
Comment