MySQL Forums
Forum List  »  PHP

Re: Calculation with row value
Posted by: Peter van Hanegem
Date: December 16, 2014 01:15PM

This is what is was looking for. I also was trying to solve it at a differrent approach.

$sql = "SELECT * FROM `schema` INNER JOIN `BANDS`
ON `schema`.BANDID = `BANDS`.BANDID ";

$result = mysql_query($sql) or die(mysql_error());


$time = strtotime('12:55');
$begin = date("H:i", strtotime('+ 5 minutes', $time));

echo'<table>';

while($row = mysql_fetch_array($result))
{

$duur = $row['DUUR'];

$end = date("H:i", strtotime("+ $duur minutes", $begin));

echo'<tr>
<td>'.$row['POSITIE'].'</td>
<td>'.$row['DUUR'].'</td>
<td>'.$begin.'</td>
<td>'.$end.'</td> ';

echo'</tr>';
$begin = $end;
}
echo'</table>';

This also works almost. This is the table i get:

1 30 13:00 01:30
2 20 01:30 01:20
3 35 01:20 01:35
4 25 01:35 01:25

It does not calculate with the $begin, do you know why ?

I want to get both options working and then see which is more handy to work with

Options: ReplyQuote


Subject
Written By
Posted
December 09, 2014 01:44PM
December 09, 2014 05:57PM
December 10, 2014 12:55PM
December 10, 2014 05:17PM
December 11, 2014 11:13AM
December 15, 2014 04:56PM
Re: Calculation with row value
December 16, 2014 01:15PM
January 14, 2015 01:15PM
December 10, 2014 09:35PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.