www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] math question based off my earlier question.

Hybrid View

  1. #1
    Join Date
    Jun 2011
    Location
    California
    Posts
    383

    resolved [RESOLVED] math question based off my earlier question.

    If I input: Quantity = 10
    Duration_minutes = 180
    Duration Seconds = 600

    PHP Code:

    $results 
    sql::clean_row("
    SELECT
    quantity,duration_minutes,
    duration_seconds
    From event.dbo.process_data"
    );
    echo 
    $results['duration_minutes'] . " " $results['duration_seconds'] . " " $results['quantity'] . "<br />";
    echo 
    $total_duration =(($results['duration_minutes'] * 60 $results['duration_seconds'])/60) / $results['quantity'];
    echo 
    round($total_duration1) . " - Time <br />";

    echo 
    ROUND($total_duration); 

    My output is:

    1919 - Time

    19 < rounds back to 19.

    I'm not happy with the seconds output though, it's roughly 600 to every minute... how should i go a fix to get back to 60 seconds is every minute?

  2. #2
    Join Date
    Jun 2011
    Location
    California
    Posts
    383

    Question

    I guess this question must of not made any sense...

  3. #3
    Join Date
    Nov 2012
    Posts
    24
    With your input above the result is exactly 19, there are no decimal digits to round. If you want the 19 to round to 20 you will have to use it like
    Code:
    echo round($total_duration, -1);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles