[snip]
We then test, using if, to see if $resultT is true or false.  If it's 
false we are then supposed to enter a new record.
Problem: it's never false.   It always evaluates true.  What am I doing 
wrong?   TIA

/*   build query to see if the record is entered already */
     $sqlT = "select * from users where username='".$_POST["name"]."'";
     $resultT = mysql_query($sqlT);

/*   Now test -- did we find anything ... if not add this user */
     if (! $resultT) {
/*  here we add the new record if it doesn't already exit /*
[/snip]

You have set $resulT like this;

$resultT = mysql_query($sqlT);

So it will always be true. What you want to do now is find if $resultT
contains any rows;

if(0 != mysql_num_rows($resultT)){
        /* add record */
} else {
        echo "Record already exists\n";
}

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

Reply via email to