Ok... I am trying to have this registration page search a table in a db to find out if the user name supplied is unique. Here is the syntax that I used but it does not seem to work:

<?
.....

$var_UserName = addslashes($_POST['User_Name']);

.....

$query = "SELECT * FROM company_info WHERE UserName = '";
$query .= $var_UserName."'";

$result = mysql_query($query);

// This is where the problem come in... I tried these two options, both
// failed.

//Opt1
$num_results = mysql_num_rows($result);

if( $num_results > 0 ) //this user name is not unique
{ // exec the error methods.... }
else
{ // add record to db }

//Opt2
if( $results ) // To my knowlegde ;) this would be true if $results > 0
{ // exec error }
else
{ // add record }

.....
?>

Is there something that I am missing? Or actually doing wrong? If anybody would need to see the whole script I would be glad to supply on demand.

Thank for your time,
-Alex


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to