Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Avg Time On-site Calculation


I am collecting the date and time of each visit to pages on a web-site into a MySQL DB. Would now like to use that info to calculate the avg time a visitor has been on the site.
What is the best way to do that?




View Complete Forum Thread with Replies

Related Forum Messages:
TIME Calculation - Period Spent On Site.
just aim trying to make a fucntion to calculate a period of time
aim making trfic website analysis I mean for example i must know
when a user is logedon and logedOut So i can know the period he
has spent in the site?

Ofcourse i have the time[when he login and logout] i am tring to...

View Replies !
Time Calculation With Php
users of my web site enter time and distance of a run the did into a http-form. the data will be processed by a php-script and stored in an mysql-database. what i want to do is to calculate from the data what time they needed for a 1k-run -> i.e.: if one runs 12k in one hour it will be 5 minutes for 1k.

the problem is, the data from the textfield of the form comes in as a string and hence i just can't divide the data ride away.

time input should look like: 1:00:00
distance input should look like: 12
and output should look like: 0:05:00

any ideas?

View Replies !
Time Calculation
does anyone know how to calculate time difference between 2 periods of time(say 12:00 am and 1:00am) ?? i have been trying to come up with an algorithm but bugs keep crawling in.


View Replies !
Time / Date Calculation
I'm having trouble getting this code to work. can someone please take a look and tell me what I'm doing wrong? I'm trying to calculate time in minutes/days of the 2 dates.

<?php
$dateFormat = "m/d/Y H:i:s";

$targetDate = "4/13/2007 05:14:01";
$actualDate = "4/13/2007 04:14:01";

$secondsDiff = $targetDate - $actualDate;

$remainingDay     = floor($secondsDiff/60/60/24);
$remainingHour    = floor(($secondsDiff-($remainingDay*60*60*24))/60/60);
$remainingMinutes = floor(($secondsDiff-($remainingDay*60*60*24)-($remainingHour*60*60))/60);
$remainingSeconds = floor(($secondsDiff-($remainingDay*60*60*24)-($remainingHour*60*60))-($remainingMinutes*60));............

View Replies !
Elapsed Time Calculation
I am developing a basic ticketing system to log customers calls on etc. I have a MySQL table that stores the time the ticket was created/logged in a MySQL timestamp IE NOW() which gives the value of something like this: 2005-08-26 19:45:11

I am wanting to figure out how long it has been since this ticket was generated (Age of ticket) since the date it was created, can anyone help me out ? I have trawled the web for a solution but as yet have come up with very little.

View Replies !
Script Processing Time Calculation?
Is there a way to calculate the time it takes to run a script, and a way to show how man cpu cycles it took to run it?

View Replies !
Date/Time Worked Calculation
I`m trying to write a function to calculate the hours worked by day or night and how much a person get paid according to the following criterea:

daypay is when worked between 8Am and 8PM and nightpay is when worked between 8PM and 8AM.

Sometimes the person starts just before 8PM and continue work untill after 8PM , or starts his duty after 8pm and ends before or after 8am next day.

Here is what I tried to do so far , yet its not working for all cases endtered. Code:

View Replies !
Rendered Site Display Time
Can php be used to display the time it took for a page to render on the client's side? Just wondering how other sites did that whole, "<insert site name here> was rendered in 0.00034 seconds" trick.

View Replies !
View The Time When Entering Site
I would like to view the time when entering my site, in the format: 18:09 Does anybody know a solution for this?

View Replies !
Set The Date N Live Time For My Php Site?
how to set the date n live time for my php site?
which all php files of my site sharing the same live date/time
and the live date/time appear in each php page.

View Replies !
AVG Calculation
how to times my AVG answer by 10, my AVG shows and answer of 5 and i want it to show 50 representing the percentage, Also how would i show this as a percentage not a normal number.

View Replies !
Calculation
I'm creating an order form whereby result is displayed in the next page.

<input type="radio" name="gift" value="toy A"/>
<input type="radio" name="gift" value="toy B"/>
<input type="radio" name="gift" value="toy C"/>

They cost $5, $10 and $15 respectively.

<input type="checkbox" name="extras[]" value="Ribbon" />
<input type="checkbox" name="extras[]" value="Card" />
<input type="checkbox" name="extras[]" value="Wrapper" />
<input type="checkbox" name="extras[]" value="Box" />

Additional $1 for each of the extras checked.

How can I know which toy is chosen, which extras are selected and total up the cost? I just need to display the final total cost.

View Replies !
Sql Calculation
I just started using php and mysql for the past 1 month and slowly picking things up: i got a question on DB calculation. Pls refer the table below:

account number ¦ payment
-----------------------------
45621 ¦ $100.00
45621 ¦ $50.00
42000 ¦ $70.00
42000 ¦ $20.00
42000 ¦ $30.00
45656 ¦ $95.00

For the account number, notice that there is duplicate account number with different payment value. Now, how do I calculate the total value for each account ie: for 45621 = $ 150.00 and 42000 = $120.00.

View Replies !
Date Calculation In PHP
Hi!

I'm trying to get a date with PHP i.e. 14 days from now in yyyy-mm-dd or any other format like print (date("Y-m-d")) + 14 days.

Is there an easy way to do this??

View Replies !
Binary Calculation
I need some way of determining which bits are set in a binary number.

eg.

Decimal Number: 40
Binary Number: 00101000

How can I determine that the binary equivalent of 8 and 32 are set??

View Replies !
Duration Calculation
I had a look at a post here in regards to this issue but after it i was blank. I gave it a shot and i got a wrong value.

View Replies !
PHP Math Calculation
I am trying to perform a simple calculation from variables passed from a form. The code is as follows:

<?php
echo "Bonus for the year: <b>";
$x = (($awage * $nibt) + ($awage * $ratio));
$x = number_format($x, 2);
print $x;
echo "</b><p>";
$xtmp = ($x + $qtr);
print $xtmp;?>

The calculation multiplies two different values (based on values from the previous page), and then sets it equal to $x. The first calculation prints fine, but when I try to add it to $qtr (also passed via radio button from previous page), it doesn't calculate correctly.

I found that if I hard-code the values for $x and $qtr after I print $x, then it will calculate correctly. I am thinking that I am using the variables incorrectly somewhere.

View Replies !
Leave Calculation
for example, for the first 2 years, he does not has bonus leave, on the third year onwards, he has 1 day increase. by default, he has 18 days leave, on the third year, he can carry forward the 10 days from the previous year, now, he has 28 days leave plus 1 day bonus leave = 29 days. same with the fourth year, he can carry forward 10 days, so, he has 39 days leave plus 1 day bonus leave = 40 days.

if he apply 2 days leave in the first 2 years, the balance is 16 days. on the third year, he only can carry forward 10 days only, not 16 days. if he apply 12 days leave in the first 2 years, the balance is 6 days. on the third year, he only can carry forward 6 days only, not 10 days. this is the problem that u don't know how to fix, can you teach me?

View Replies !
Date Calculation
I would like to make a selection from the database in the following manner ie which is created in the last 1 week or last 2 weeks. There is one field named created_date in the database and the date is in the format yyyy-mm-dd. I have seen date calculations based on month and year but didn't see one on a week basis.

View Replies !
Days Calculation
i can't seem to get this what im trying to do is work out the elapsed time in DAYS from 2 dates code is:

             $time_now = time();
             $d2 = date('Y-m-d H:i:s', $time_now);
             $d1 = date('Y-m-d H:i:s', strtotime($ng_date));
             $days = ceil(($d1 - $d2) / (60 * 60 * 24));
when echoing out it produces:

2007-06-02 16:53:24
2007-08-27 18:00:51
which is right, but $days echoes out as 0.

View Replies !
Add Trailing Zero To Calculation
I am pulling a couple of numbers from a database (productcost and productprice).  I am trying to subtract the cost from the price to calculate the profit of the item.  I have this part working with no problem. My problem lies when the final number has a trailing zero it will drop that number (i.e. 1.2 as opposed to 1.20)

Here is what I am using:

$profit = $row_viewcoils['ProductPrice'] - $row_viewcoils['ProductCost'];
      echo $profit;

View Replies !
Calculation Form
I need to build a calculation form.. basically they click a couple radio buttons from features they want and then the user enter's in the number of words of the document and then they hit "calculate" button and it gives them an estimate for a quote. Need a little help with the structure of the form, anyone shed some light?

View Replies !
Percentage Calculation In Php
i have the following calculation code that adds the $total and the $tax variables..

number_format($total+$tax,2,'.','')

how i can calculate the total and then subtract 15% of the final value.

View Replies !
Calculation In A Query?
Is it possible to do something like this:

UPDATE `Members` SET `hungerlevel` = (hungerlevel - 1)

Im trying to run a query that updates all users in my member table and it takes 1 off their hungerlevel. I could do a while loop i suppose... i was just wondering if there was a way to do it this way.

View Replies !
Database Calculation
for example i rent a space for stock keeping and i can get 1% of total prices per day. I had created a database to record all in/out stock per day as:

[date] [status] [quantities] [unit_price]
2007-09-16 'IN' 1000 3.50
2007-09-16 'OUT' 100 3.51
2007-09-17 'IN' 500 3.40
2007-09-18 'IN' 1000 3.35

Sorry for my dumb, i'm stuck on a database calculation above. i hope any expert can show me how to get income calculation between $date1 and $date2 through sql query?

View Replies !
PHP/HTML Calculation
I am making a little Purchase order entry form for a mysql database. I have the form and can submit everything just fine, Only thing is I can't seem to figure out how to make a calculation on various text boxes.

I need to make a sum of a group of boxes, calculate taxes etc... Anyone able to point me to some sample code of a way to make arthimatic functions on the contnts of box1 and box 2 and put them in box 3. I will only be inserting box 3 into the database and that part works already.

View Replies !
ORDERING BY My Calculation
Is there any way I can ORDER BY $sum so that the smallest one is shown first, the problem is because the sum comes after the SELECT statement. This is a simplified version to my much larger problem. PHP Code:

$maths = "SELECT * FROM maths";
$mathsResults = mysql_query($maths);
while ($mathsRow = mysql_fetch_array ($mathsResults)){
$int1 = $mathsRow["int1"];
$int2 = $mathsRow["int2"];
$sum=$int1+$int2;
echo $sum;
}

View Replies !
Shipping Calculation
I've got to add another condition to my shipping calculation - right now it reads:

if ($total > 81.75)
{printf ("%01.2f", $total * .11);}
else {echo "8.99 ";}

The condition I need to add needs to accomodate International shipping - $total * .25. I have a field for '$shipcountry' - the new condition needs to identify whether the order is being shipping with USA or goes to another country... : something like....

IF $shipcountry = "USA",
THEN DO USE CODE ABOVE
ELSE $total * .25

It looks like a couple of IFs AND then ELSE to me...just wish I knew how to write it.

View Replies !
Array For A Calculation
I am currently using a an array to perform a calculation similar to

http://www.webmasterworld.com/forum88/7085.htm.

[example]
$nearest_distance = array();
$findLocations = mysql_query("SELECT latitude, longitude FROM locations");
while ($loop_findLocations = mysql_fetch_array($findLocations)) {
$latitude = $loop_findLocations["latitude"];
$longitude = $loop_findLocations["longitude"];
$yarddistance = distance($latitude, $longitude, $cutomerlat, $cutomerlong, "m");
$nearest_distance[] = $yarddistance;
}
sort($nearest_distance);
print_r($nearest_distance); // print array
echo '<br> Best Yard:'. $nearest_distance[0];

View Replies !
Calculation With Month...
I create some search option with drop down list box. search by month is 1 of them. I've a table named orders, suppose LabOrder_No & Log_date. dates are storing in database as yy-mm-dd but im retriving as dd-mm-yy.

I will select a month name from list (jan,feb....dec & their values are 01,02...12), click submit button & display the total orders & quantity of that month. to collect total quantity, i wrote a function: Code:

View Replies !
Calculation Of Items
I was just wondering what method is best to use to calculate items from a drop down menu. I have two lots of drop down menu of which i want to send to a page to clarification before being submitted.

View Replies !
Days Ago Calculation?
<?php
$month = 10;
$day = 17;
$year = 2006;

$days = (mktime(0, 0, 0, date("m"), date("d"), date("Y")) - mktime(0, 0, 0, $month, $day, $year)) / 86400;
echo $days;
?>

-> Take the seconds from unixtime now, minus unixtime date, split by seconds in a day = amount of days ago Problem is, the output is: Code:

View Replies !
Calculation Problem
im working out a users age, by deducting the year they were born from this year 2007

so i'm born on 1979, todays year is 2007

2007 - 1979 leaves 28

but the code shows as -28 instead of just 28, i tried a str_replace but no joy

  ## Year calculation
  $profileyear = $yearborn - $thisyear;
 
  ## Get rid of the - sign
  str_replace("-"," ", $profileyear);

can anyone tell me what i did wrong?

View Replies !
Leap Year Calculation
how can i incorporate leap year also at my below codes PHP Code:

View Replies !
Create A Function To Do The Calculation
writing the following lines of code into a simple
function. I'd like to be able to create a function to do the
calculation, then feed the $a, $b, or $c variable into it.

<?php $a = $kerryvotes/$votes;
$kpercentage = $a * 100;
$kpercent = round($kpercentage, 0);
?>

<?php $b = $bushvotes/$votes;
$bpercentage = $b * 100;
$bpercent = round($bpercentage, 0);
?>
<?php $c = $nadervotes/$votes;
$npercentage = $c * 100;
$npercent = round($npercentage, 0);
?>

View Replies !
Date Comparison Calculation
I want build and extract data from a mysql table by date. The problem is that my table data needs to be by date range as follows.

Example: key field is DATE field
row 1: 02-19-96 to 02-06-97
row 2: 02-07-97 to 01-27-98
row 3: 01-28-98 to 02-15-99

and the input for the query will come from a FORM input (without range), example:
Enter birthday input value could be 05-13-96 How can I query the table and select the row with the correct range.

View Replies !
Relative Link Calculation
I am implementing a semi-template system via the use of 'include()' which pull from files from in a dir in the document root. But as the depth of the files in the direcotry structure changes, you can well imagine that relative links get messued up as the include runs the script from the path from which it was called not the path from which it got the file. So basically I'd just like to know if anyone has a smart script to calculate reltative links.

View Replies !
Date Input And Calculation
I need to input the time into a form for a start time and an end time, and write it to the database. I also need to calculate the time to see the time elasped, and input that into a database, for a field of time spent.

View Replies !
OT: Franchisee Area Calculation
I've searched the web for weeks (on and off) but can't find any
information about the topic.

A client wants to set up a franchisee structure and track this
information via a database.

I've never done this and uncertain of how I would do it.

Initially the client only wants state by state franchisees but I can
see that this could eventually be scaled to districts/areas.

To compound matters, my client is wanting this to work in any country.

View Replies !
Problem With Date Calculation
im a really noob fresh starting php programmer:P

but i need really to solve this problem witha php script:

I can rent a flat from 01/01/90 to 01/01/2011
ill rent that flat for a time that i will choice from that timeline above,
so ie I could rent that flat from 01/15/93 to 01/15/95.

well at this point i need to know how mani days for each year i rent that
flat in the above case it would be like this:

year 1990= 0
year 1991=0
year 1992=0
year 1993 = 15
year 1994=365
year 1995=15
year 1996=0
year 199...
year 2011=0

since im really noob could plz give me:
1)an input about the logic process to use to write a script
2)wich command i should use
3)a whole script or an idea of it if u can

i know the days from and to each period, i cant just find the right routine
to get the above datas

View Replies !
Simple Date Calculation
I have two dates and I would like to get the difference in minutes:

$date1 = date("Y-m-d H:s:i"); // now
$date2 = // a date in the same format as above just retrieved from the database it will be in the future

So I would like to get just the minutes between them.

View Replies !
Simple Calculation Between Array
i have two arrays :

$quantity = array(1,2,3);
$price = array(15.45,12.3,23);

how do i make those two arrays for a multiply calculation like this :

$total = $quantity * $price;

i want the total of the calculations in a new array

View Replies !
Street Address Calculation
Does anyone know of a tutorial or script that will calculate driving distance between two street addresses? I have only found ones that does it base on zip codes.

View Replies !
Calculation And Limiting Decimals
I have a greater total of 61 and I score 45

$i= 61;
$y= 45;

$pct = ($i /$y) * 100;

one is tha correct Two how can i limit the number that result diplays (0.987654321 - i just want .987)

and how do i turn off this error message???

Warning: Division by zero in localhostinfo.php on line xxx

View Replies !
Bitwise Server Calculation
PHP Code:

$x = (4653896912 >> 13);
echo $x;

I ran that on two different servers.

Server A gave me: 43814
Server B gave me: 568102

Any clue why that would happen? Maybe a work around or another way of doing that calculation?

View Replies !
Calculation Always Give A 0 Result.
I have 1 form that calls a php page using the post option. The text box used has a name value = rent. When placed into the php page the result is always 0.

View Replies !
Special Date Calculation
If you start my class on Monday,Tuesday, Wednesday or Thursday, you will Graduate on the 7th Friday. ALWAYS. You always grad on Friday. I want to make a web form that you can put a start date in, and it will return the Grad date.

Any ideas? I've thought about building a database table with the dates in it, and also just using PHP or Javascript to do the calculations.

View Replies !
Postage Calculation By Weight
How could I write a PHP code where starting at 12501 grams to lets say 75000 grams, the postage cost would increase by $30 every 2500 grams. Or may an infinite calculation for 12501 grams and above? Code:

View Replies !
Server Load Calculation
I've seen some sites that display a "Server load" value in percentage. I've tried to google out the formula they may be using but I couln't find it. I'd like to implement such a thing in a Linux server but the typical values returned by "uptime" (number of queued processes) are not as easy to understand as a simple %.

View Replies !
Help With Function For Displaying Calculation Results
I am developing a betting calculator and at the moment I am working on some functions that can be used to display the HTML for the form to enter your bet and odds and the results.

I am still relatively new to PHP and I am learning all the time so sorry if this is a simple problem!

I have 3 files: calc1.php, index.php and funtions.php

Here is index.php PHP Code:

View Replies !
Distance Calculation Based On ZIP Codes,etc (need Help)
Does not anyone know how distances are calculated on sites like mapquest.com and verizon.com.

You type in the ZIP code or some other information and they tell you how far something is from it or businesses in a particular radius.

View Replies !
Date Calculation Problem W/ Mktime()
I am having a problem with calculating a date. What I am looking to do
is get the date of Sunday of this week, then use mktime() to find out
other days in the past by subtracting days.

In the code below, today is Saturday, October 16, 2004, this week's
Sunday is 2004-10-17. I successfully get that.

But, when I try to subtract 7 days using mktime(), I instead of getting
2004-10-10, I get 1969-12-31.

I have looked through php.net/mktime and searched some example via
Google, but I stuck. Any help would be greatly appreciated.

CODE BELOW:

$today = unixtojd();

// GET THIS WEEK'S SUNDAY
$this_sunday = $today + (7 - jddayofweek($today)) % 7;
$current_sunday = jdtogregorian($this_sunday);
$this_sundays_parts = explode("/",$current_sunday);
$cur_sunday = $this_sundays_parts[2] . "-" . $this_sundays_parts[0] .
"-" . $this_sundays_parts[1];

// GET LAST WEEK'S SUNDAY

$last_sunday = date("Y-m-d", mktime(0, 0, 0,
date($this_sundays_parts[2]), date($this_sundays_parts[0]),
date($this_sundays_parts[1])-7));

// PRINT OUT THE DATES
print "This Sunday is " . $cur_sunday . "<BR>";
print "Last Sunday was " . $last_sunday . "<BR>";

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved