Jump to content

[SOLVED] Inserting values into mySQL on page load rather than submit button?


webmaster1

Recommended Posts

Hi All,

 

(apologies for the fractional threads)

 

I have a page (invalid.php) that basically echoes an error message.

 

In the background I want to write the IP address and date to insert into a mySQL table every time the page loads rather than when a submit button is clicked.

 

How would I trigger this based on the below snippet of code:

 

$ipaddress = getenv('REMOTE_ADDR');

query = "INSERT INTO invalid VALUES ('','$ipaddress',NOW())";
mysql_query($query);

 

 

D'oh!  :-[

 

Thanks guys.

 

I always make the assumption that "nah, it could never be that simple."

 

I geuess if theres no if condition and all the variables are attainable then it just does its thing.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.