Jump to content

Counting values and ad to table, with time tracking


xwishmasterx

Recommended Posts

I am in need of suggestions on how too achive this:

 

I have a surf exchange and whenever a member has viewv a site, it ads this members Id and time to a table called vtp_tracking.

 

I have now created a team script, so I can count the total of surf for members within this team from the vtp_table.

 

What I am in need of is this:

I would like to add a bonus for the teams, so my idea was this: every hour run a cronjob to get the results for the last hour by team id lik so:

 

WHERE vtp_members.team_id="teamid" AND vtp_tracking.credit_members_id=vtp_members.id AND vtp_tracking.action_date>date_sub(NOW(),interval 60 minute

 

I believe the above code will work fine and get me the results for team members for the last hour.

 

Problem: how can I get this result, multiple it with the value from another field and divide by 100  and add this to a third field?

 

eg: (result from above * value from other field / 100) then add to a third field.

 

Anyone willing to try and answer this one?

Link to comment
Share on other sites

Thats the last part of it..thank you for that!

 

My "REAL" problem is I know how to get the info needed from the database, I just tried my script and it returned:

 

Team 12 has surfed: 3 sites

 

by using this code (end of it)

while ($row = mysql_fetch_array($result)) {
echo "Team ".$row[team_id]." has surfed: ".$row[surfs]." sites";}

 

I don't know how to get these results and then apply you update code.

The math part should be applied to the ".$row[surfs]." result, and then "UPDATE" into table 'teams' where ".$row[team_id]." = team_id

 

I hope I make sense, just started learning php a few days ago.

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.