dingus Posted September 29, 2007 Share Posted September 29, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/71145-inplace-update-of-string/ Share on other sites More sharing options...
rarebit Posted September 29, 2007 Share Posted September 29, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/71145-inplace-update-of-string/#findComment-357823 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.