On Thu,  6 Sep 2001 18:09, [EMAIL PROTECTED] wrote:
> Can someone tell me what i'm doing wrong here?
>
> <?php
>  //Connect to db
>  $db = mysql_pconnect("localhost","login","pass");
>  mysql_select_db("database",$db);
>
>  //Check for the IP
>  $result2 = mysql_query("SELECT ip FROM ip where ip =
> '$REMOTE_ADDR'",$db);
>
> while($myrow<>mysql_fetch_array($result2))
>  {
> echo "Print some text here!";
>  }
> ?>
>
> Basically I just want to print text if the IP address was not found in
> the database, and if it was found then I want to print "Print some text
> here!"
>
> Please help!
> Thanks,
> Nate

I think it would make more sense to check the number of rows found, and 
act accordingly. If you don't need to use any of the info from the DB, 
you could do a SELECT COUNT(ip) WHERE ....

Alternatively, test mysql_num_rows($result2).


-- 
David Robley      Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES      Flinders University, SOUTH AUSTRALIA  

   He who laughs last probably made a backup.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to