Jump to content

Recommended Posts

Hello,

 

I'm making a link exchange script and i was wondering what would be the best way to make it.

 

Ive got the stats tracking for each day for hits in and hits out, every day them hits are placed into another field in the database which is to display the hits which happened yesterday.

 

I also want to display the hits for a whole month for hits in and hits out and display the difference so i know how much traffic i owe certain sites.

 

This is the part I'm stuck on really, do i need 60 fields in the database for each days in and out hits then find out the difference between the total. Im really confused and need some advice.

 

Thanks

Exoon

 

 

Link to comment
https://forums.phpfreaks.com/topic/140511-link-exchange-script/
Share on other sites

No you only really need about 4 fields:

 

id

hits_in

hits_out

time

 

In the time field you would put a timestamp. A timestamp looks like this 094345834. It is the number of seconds since a long time ago. You can then query the database against that to see the results you want. For example:

 

$last_day = 60*60*24; //60 seconds time 60 minutes times 24 hours is a day
$time = time(); //makes it the 094345834

$twenty_four_hours = $time - $last_day;

 

Again this is just an example.

Link to comment
https://forums.phpfreaks.com/topic/140511-link-exchange-script/#findComment-735273
Share on other sites

Adding to what premiso said I will give you an example. You can convert a timestamp to a date using the date() function like this:

 

$time = time();
$date = date("m/d/Y", $time);

 

I would look into the timestamp and date functions a little farther if I was you.

Link to comment
https://forums.phpfreaks.com/topic/140511-link-exchange-script/#findComment-735335
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.