Current location: Hot Scripts Forums » Programming Languages » PHP » [SOLVED] Column stops adding.


Column stops adding.

Closed Thread
  #1 (permalink)  
Old 01-31-10, 11:33 PM
lavochkin's Avatar
lavochkin lavochkin is offline
Newbie Coder
 
Join Date: Jan 2010
Location: Boulder City , NV
Posts: 13
Thanks: 3
Thanked 0 Times in 0 Posts
Exclamation Column stops adding.

Why would a column total reach a number and stop? Pilot Stats

If you would look at the link here and top of page you will Total Flight time. It reads 838:59:59 in a time format 838 hours, minutes , seconds.

Here is problem script I think. reads like this:

$query = "SELECT sec_to_time(sum(TIME_TO_SEC(TotalBlockTime)))FROM flights".$condition;
$result=mysql_query($query);
$TFT = mysql_result($result,0);

Can anyone help me please.
  #2 (permalink)  
Old 02-03-10, 05:35 AM
scott2500uk's Avatar
scott2500uk scott2500uk is offline
Coding Addict
 
Join Date: Apr 2006
Posts: 275
Thanks: 2
Thanked 2 Times in 2 Posts
the reason why you are getting this is due to the limit in the datatype of TIME in MySQL

EDIT : nevermind you've made two posts. http://www.hotscripts.com/forums/php...tml#post186046
The Following User Says Thank You to scott2500uk For This Useful Post:
wirehopper (02-03-10)
  #3 (permalink)  
Old 02-03-10, 01:58 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
What's the problem?
  #4 (permalink)  
Old 02-03-10, 04:06 PM
Jcbones Jcbones is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 516
Thanks: 5
Thanked 47 Times in 44 Posts
Mysql Bug, answered in the second post.
  #5 (permalink)  
Old 02-03-10, 05:47 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
If you change the query ...

PHP Code:

$query "SELECT sec_to_time(sum(TIME_TO_SEC(TotalBlockTime)))FROM flights".$condition
to

PHP Code:

$query "SELECT SUM(TIME_TO_SEC(`TotalBlockTime`)) AS 'total'  FROM `flights` ".$condition
then used

PHP Code:

$hours=$total 3600;

$minutes=$total 3600;
$seconds=$total 60
Not tested
The Following User Says Thank You to wirehopper For This Useful Post:
lavochkin (02-04-10)
  #6 (permalink)  
Old 02-04-10, 08:47 PM
lavochkin's Avatar
lavochkin lavochkin is offline
Newbie Coder
 
Join Date: Jan 2010
Location: Boulder City , NV
Posts: 13
Thanks: 3
Thanked 0 Times in 0 Posts
Wink So it would look like this?

So it would look like this??

$query = "SELECT SUM(TIME_TO_SEC(`TotalBlockTime`)) AS 'total' FROM `flights` ".$condition;
$hours=$total / 3600;
$minutes=$total % 3600;
$seconds=$total % 60;
$result=mysql_query($query);
$TFT = mysql_result($result,0);

Thank-you

Rick Parkin
  #7 (permalink)  
Old 02-04-10, 09:37 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
You have to get the $total from the query.

PHP Code:

$result=mysql_query($query);

$row=mysql_query_assoc($result);
$total=$row['total']; 
  #8 (permalink)  
Old 02-05-10, 08:25 AM
lavochkin's Avatar
lavochkin lavochkin is offline
Newbie Coder
 
Join Date: Jan 2010
Location: Boulder City , NV
Posts: 13
Thanks: 3
Thanked 0 Times in 0 Posts
Ok, ok

Great, Now where do I put this:

$hours=$total / 3600;
$minutes=$total % 3600;
$seconds=$total % 60;

Or do I need this with the script you have given me. I am new to this PHP. I have learned by the dummies book. And taken others script and changing it to do what I want.

WireHopper are you for hire?

Best Regards
Rick Parkin
  #9 (permalink)  
Old 02-05-10, 11:49 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
PHP Code:

$result=mysql_query($query); 

$row=mysql_query_assoc($result); 
$total=$row['total']; 
$hours=$total 3600;
$minutes=$total 3600;
$seconds=$total 60
Not tested
  #10 (permalink)  
Old 02-05-10, 04:38 PM
lavochkin's Avatar
lavochkin lavochkin is offline
Newbie Coder
 
Join Date: Jan 2010
Location: Boulder City , NV
Posts: 13
Thanks: 3
Thanked 0 Times in 0 Posts
Thanks, But

Thanks, but that is not going to work. I starting to think that there is no way around this??

It looks like it is counting rows?? answer is 1

Thank-you for time and effort.

Best Regards,
Rick Parkin
Closed Thread

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a value to all fiends in a table column pcinfoman Database 4 02-25-09 02:44 PM
Firefox and align problems gigafare CSS 12 01-07-07 11:22 AM
Overlapping table cells in IE, table/css three column layout (WebTV info also wanted) TwoD CSS 4 11-09-06 07:39 PM
Keep formating when adding new column to mysql jsad PHP 4 01-05-05 05:43 AM
I most definately suggest DevelopingCentral.com For Any Website Design/Development! Salty777 General Advertisements 2 10-01-04 04:27 AM


All times are GMT -5. The time now is 08:09 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.