Re: mysql_fetch_array
| From: | sagar | Date: | Thu, 06 Sep 2001 19:46:01 +0000 |
| Subject: | Re: mysql_fetch_array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-66262@lists.php.net to get a copy of this message | ||
hi,
just go thru ur code once u'll getout with the bug.
$myrow<>mysql_fetch_Array($result2);
what is $myrow and to which value should the left part should
compare.
try this :
<?php
file://Connect to db
$db = mysql_pconnect("localhost","login","pass");
mysql_select_db("database",$db);
file://Check for the IP
$result2 = mysql_query("SELECT ip FROM ip where ip = '$REMOTE_ADDR'",$db);
$myrow=mysql_fetch_Array($result2);
if($myrow)
// if there is a record then the code goes here
else
echo("print some text here");
?>
/sagar
----- Original Message -----
From: <nate@1feehosting.com>
To: <php-general@lists.php.net>
Sent: Thursday, September 06, 2001 2:09 PM
Subject: [PHP] mysql_fetch_array
Can someone tell me what i'm doing wrong here?
<?php
file://Connect to db
$db = mysql_pconnect("localhost","login","pass");
mysql_select_db("database",$db);
file://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
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com