Depends on hwo you want your logic to work, but I think what you have isn't terribly accurate, because you're testing $result and mysql_num_rows() at the same time -- it's hard to explain...... perhaps you should actually do this:
if($result) { if(mysql_num_rows($result) > 0) { // do this } else { // do this } } else { echo "mysql query failed " . mysql_error() . "<br />"; } JF on 19/11/02 2:10 PM, Peter Houchin ([EMAIL PROTECTED]) wrote: > > Hi > > just wanted to say thanks Justin.. I've got it working with your idea .... I > needed to change this line.... > > if($result && mysql_num_rows($result) > 0) > > to > > if ($result && mysql_num_rows($result) < 1) > > and it works a treat. > > Thanks > > Peter > >> 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 >> -------------------- >> >> > 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