Remote IP in Query
From: BeBoo (macbrando2001_at_hotmail.com)
Date: 12/26/03
- Next message: BeBoo: "Re: NEED a forum with the followig features"
- Previous message: Shawn Wilson: "Re: stop someone reloading a page"
- Next in thread: lallous: "Re: Remote IP in Query"
- Reply: lallous: "Re: Remote IP in Query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 26 Dec 2003 09:10:24 -0500
I've been trying and trying and I got it once and I don't know how I did it.
I need to grab the person's IP address and put it in the WHERE part of the
sql query. I have the following:
$sql = " SELECT * FROM ipandname ";
$sql .= " WHERE IP = {$_SERVER['REMOTE_ADDR']} ";
But I get the following on the page:
Database Error: SELECT * FROM ipandname WHERE IP = 68.83.29.13 You have an
error in your SQL syntax. Check the manual that corresponds to your MySQL
server version for the right syntax to use near '.29.13' at line 1
It thinks that the IP address is a number (obviously you can't have more
than one decimal point in a number). IP is defined as a char(20). How do I
put the $_Server variable INTO the query and make sure it thinks it's just a
string? Any help at all would be appreciated.
Thanks a lot.
Brandon
- Next message: BeBoo: "Re: NEED a forum with the followig features"
- Previous message: Shawn Wilson: "Re: stop someone reloading a page"
- Next in thread: lallous: "Re: Remote IP in Query"
- Reply: lallous: "Re: Remote IP in Query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|