SELECT COUNT giving 0 HELP
Posted: Thu Mar 05, 2009 10:48 am
hey guys, I am doing a control list using ip's so I want to count how many ip's with the same number do I have in my database equal to the person that is submiting the form in my webpage.
So im using this code:
basically I am getting the number 0, I am doing this test with my own ip and I have 11 not 0 :X
when I do print $ip; he gives me my ip but it is not working the query I do not know what is going on.
help me with the code to extract correctly the amount from the query.
cheers
So im using this code:
Code: Select all
$ip = $_SERVER['REMOTE_ADDR'];
$checkin_ip = ('SELECT COUNT(ip_address) FROM `spam` WHERE `ip_address` = "$ip"');
$ipget = mysql_query($checkin_ip);
$ipid = mysql_fetch_array($ipget);
$ipid = $ipid[0];when I do print $ip; he gives me my ip but it is not working the query I do not know what is going on.
help me with the code to extract correctly the amount from the query.
cheers