This topic is locked

This doesnt work but it doesnt create any error either

6/4/2008 10:24:23 PM
PHPRunner General questions
B
bochaka author

Hi

I put this code together to get the ip address of a user before he enters a record ,and store it in a table field.

The code doesnt appear to work, but its not producing any errors either, the field i wanted it to be entered in is named logedip, in at able called litters. I put it in the add page event before record added.

This is one of my first attempts at scripting.

How do I fix it.

global $conn;$strSQLInsert = "insert into `litters` (`logedip`) values ('" . $_SERVER['REMOTE_ADDR']."')";mysql_query($strSQLInsert,$conn);

J
Jane 6/5/2008

Hi,
you don't need to create insert query in the Before record added event. Just assign actual value to the $values["FieldName"] variable:

$values["logedip"] = $_SERVER['REMOTE_ADDR'];

B
bochaka author 6/5/2008

Hi Jane

Do I put this in the Before record added event

J
Jane 6/5/2008

yes.

T
thesofa 11/13/2008

Why does this exact event always return the IP afddress of the proxy server?