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
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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.