Forum Moderators: bakedjake

Message Too Old, No Replies

MySQL-command + REMOTE_ADDR

         

jacobp

9:58 pm on Jun 9, 2005 (gmt 0)

10+ Year Member



Hello,

How can I get REMOTE_ADDR in the MySQL-command? - Google couldn't help me :(

mysql> SELECT * FROM [Table] WHERE Ipaddress = 'REMOTE_ADDR-command';

Jacob

jacobp

5:42 am on Jun 10, 2005 (gmt 0)

10+ Year Member



...or how can I get REMOTE_ADDR in the httpd.conf-file?
I want to use MySQL in http.conf.

Jacob

lZakl

12:08 am on Jun 13, 2005 (gmt 0)

10+ Year Member



MySql uses SQL, which is a querying language, thus can't store variables. You are going to need something to 'get' the IP of the user, and use whatever you used (I'll say you'll be using PHP) to query your database with the information gathered.

for example in PHP:

$ip = $_SERVER['REMOTE_ADDR'];

then your SQL query:

SELECT * FROM [Table] WHERE Ipaddress = '$ip';

If I understand you right, you are trying to do something that is beyond plain Structured Query Language.

-- Zak