Jump to content

Archived

This topic is now archived and is closed to further replies.

Blu_Smurf

not equal

Recommended Posts

Ok, I am making a site counter thats a site logger as well, now, I am trying to ge it it get all tables counter then with mysql_num_rows and spit out the number of all rows that are not equal to a users IP. I have tried it a number of ways, this one is the only way I don\'t get an error:

 

$sql=mysql_query("SELECT ip!=\'$ip\' FROM counter")

or die(mysql_error());

 

Im using $ip = $_SERVER[\'REMOTE_ADDR\']; to grab the ip btw :D

 

Now, am I right in that syntax to use it? Im thinking it needs to be select * from counter where ip!=\'$ip\' but I get errors when I do that.

 

Any suggestions?

 

 

Edit: nm got it, I forgot to use the \' marks when using ip!=\'$ip\'

Share this post


Link to post
Share on other sites

hehe I got it, just forgot my apostrohpe\'s lol..

 


$sql=mysql_query("SELECT * FROM counter WHERE ip!=\'$ip\'") 

  or die(mysql_error());

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.