Jump to content


Photo

not equal


  • Please log in to reply
2 replies to this topic

#1 Blu_Smurf

Blu_Smurf
  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts
  • LocationTexas

Posted 23 June 2003 - 02:08 AM

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\'

#2 shivabharat

shivabharat
  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 23 June 2003 - 03:12 AM

Try this
select * from counter where Ip<> $ip

Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks

#3 Blu_Smurf

Blu_Smurf
  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts
  • LocationTexas

Posted 23 June 2003 - 03:33 AM

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

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





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users