Re: I'm less experienced please be gentle :)
| From: | Micah Stevens | Date: | Thu, 18 Nov 2004 19:24:16 +0000 |
| Subject: | Re: I'm less experienced please be gentle :) | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-37346@lists.php.net to get a copy of this message | ||
What does it do? Does it give a specific error? I don't see anything wrong
with it. If it's not giving an error, perhaps it's returning unexpected
results?
This change may give you some insight:
change:
if(@mysql_num_rows(mysql_query($banned)) > 0) {
to:
$result = mysql_query($banned) or die (mysql_error());
if (mysql_num_rows($result) > 0) {
---
This will give you some mysql errors if that's where the problem lies.
HTH
-Micah
On Thursday 18 November 2004 11:14 am, ed@legend.co.uk wrote:
> Can anyone tell me whats wrong with the below code? it doesnt execute.
>
> $ip=$_SERVER["REMOTE_ADDR"];
>
> $banned="SELECT * FROM banned WHERE ip='$ip'";
>
> if(@mysql_num_rows(mysql_query($banned)) > 0) {
>
> echo "You have been Banned.";
>
> }else{
> echo "$ip";
> }