mysql query issues
Posted: Sat Apr 02, 2005 11:19 am
Hi im relativly new to PHP and mysql and am working on my 1st public website i am curently working on a system to stop people from entering multiple comments on a page by redirecting them to another based on ip.
The ip code is:
The problem is with the my sql query:
The problem when i echo $ip the page returns
Resource id #3
however if i enter an ip manualy as a string in place of $onlyip it will search the table for the coresponding ip as desired.
I would apreciate any help with this problem
Thanks for any help
Dav
The ip code is:
Code: Select all
if (getenv('HTTP_X_FORWARDED_FOR')){$onlyip=getenv('HTTP_X_FORWARDED_FOR');} else {$onlyip=getenv('REMOTE_ADDR');}Code: Select all
$ip = mysql_query("SELECT ip FROM `Table` WHERE ip LIKE '$onlyip' ");
ECHO $ip;Resource id #3
however if i enter an ip manualy as a string in place of $onlyip it will search the table for the coresponding ip as desired.
I would apreciate any help with this problem
Thanks for any help
Dav