Jump to content

inplace update of string


dingus

Recommended Posts

hey i'm just working on some code to track users coming and going from my site and i'm trying to minimize the number of SQL query's so for simple things like hit counting i have

 

 

$domain = $_SERVER['HTTP_HOST'];
mysql_query("UPDATE Home_Hits SET Hits = Hits + '1' WHERE Site LIKE '$domain'");

 

i have one other field in the database that will track the ip address of visitors i would like to know how i can up date the 'IP' field in the database much the same way i am with 'Hits' with out calling the data in to a variable can i do it or am i kicking a dead horse?

 

thanks guys

Link to comment
https://forums.phpfreaks.com/topic/71145-inplace-update-of-string/
Share on other sites

Looking at mine, it's not the way I thought it was. I have a page request log, with references to tables of session_id, agent and link. This may not be the most mysql efficient, yet it save's on space with maximum knowledge and is very powerful for frequency checking. This method also not only links a user to an ip, but also the session (+ time and response). Future developments will log any proxy ip's (at the moment proxies are only checked and logged at certain points, such as login, register, auth and resend (named 'severe')).

 

So, to answer your question, are you just wanting your user's last ip address, or every. Also if you put the ip in own table then you can use it's id instead. For hit's, just count the logs where sess or id are same...

 

Hope i'm not waffling, only just woke up!

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.