Hi,
on 19/11/02 1:51 PM, Peter Houchin ([EMAIL PROTECTED]) wrote:
> function new_user() {
> //check to see if the company is in the list
>
>
> $result = mysql_query("SELECT * FROM resellers WHERE
> company='$_POST[company]'");
> // if it's not then ...
> if ($result == FALSE){
> blah
> }
> //if it is then insert the rest of the stuff to the db
> else {
> $res = mysql_query(INSERT....)
> }
>
> but doing it this way doesn't seem to help.. any one got any idea's?
I'm no expert, but I think $result will return true if the query was
successful, it's not dependant on if there were rows returned.
To check if there was a row returned, use mysql_num_rows($result)
$result = mysql_query("SELECT * FROM resellers WHERE
company='$_POST[company]'");
if($result && mysql_num_rows($result) > 0)
{
// insert
}
else
{
//something else
}
Justin French
--------------------
http://Indent.com.au
Web Developent &
Graphic Design
--------------------
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php