Hi
I have a function call getMovieLength. How do I call the function so that I can calculate the $cellwidth variable in the php code below. It shows error message like below
"Notice: Use of undefined constant movieLength - assumed 'movieLength' in C:\htdocs\..\MB 2search.php on line 779
Warning: Division by zero in C:\htdocs\..\MB 2search.php on line 784"
[HTML]
$movie = $db->get_row("selec t * from Movie where movieID='" . $_GET['movieID'] . "'");
....
....
function getMovieLength( lengthString) {
times = lengthString.sp lit(':');
return (((parseInt(tim es[0]) * 60) + parseInt(times[1])) * 60) + parseInt(times[2]);
}
...
...
var movieLength = getMovieLength( "<?php echo $movie->duration?>") ;
...
...
[/HTML]
[PHP]
<?php
$allEvents = $db->get_results("S ELECT * FROM EventsShotsStar tAndStopFrames where movieID='" . $_GET['movieID'] . "' and eventCategory = 'Dialogue'");
$prevTime = 0;
$movieLengthTim eline = (movieLength * 30);
foreach($allEve nts as $timeline)
{
$frameDuration = ($timeline->shotStartFrame ) - $prevTime;
$cellwidth = round(($frameDu ration * 650)/ $movieLengthTim eline);//round here
?>
<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor=black></td>
<?php
$frameDuration = ($timeline->shotStopFram e) - ($timeline->shotStartFrame );
$cellwidth = round(($frameDu ration * 650)/ $movieLengthTim eline);//round here
?>
<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor=green></td>
<?php
$prevTime = ($timeline->shotStopFrame) ;
}
?>
[/PHP]
I have a function call getMovieLength. How do I call the function so that I can calculate the $cellwidth variable in the php code below. It shows error message like below
"Notice: Use of undefined constant movieLength - assumed 'movieLength' in C:\htdocs\..\MB 2search.php on line 779
Warning: Division by zero in C:\htdocs\..\MB 2search.php on line 784"
[HTML]
$movie = $db->get_row("selec t * from Movie where movieID='" . $_GET['movieID'] . "'");
....
....
function getMovieLength( lengthString) {
times = lengthString.sp lit(':');
return (((parseInt(tim es[0]) * 60) + parseInt(times[1])) * 60) + parseInt(times[2]);
}
...
...
var movieLength = getMovieLength( "<?php echo $movie->duration?>") ;
...
...
[/HTML]
[PHP]
<?php
$allEvents = $db->get_results("S ELECT * FROM EventsShotsStar tAndStopFrames where movieID='" . $_GET['movieID'] . "' and eventCategory = 'Dialogue'");
$prevTime = 0;
$movieLengthTim eline = (movieLength * 30);
foreach($allEve nts as $timeline)
{
$frameDuration = ($timeline->shotStartFrame ) - $prevTime;
$cellwidth = round(($frameDu ration * 650)/ $movieLengthTim eline);//round here
?>
<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor=black></td>
<?php
$frameDuration = ($timeline->shotStopFram e) - ($timeline->shotStartFrame );
$cellwidth = round(($frameDu ration * 650)/ $movieLengthTim eline);//round here
?>
<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor=green></td>
<?php
$prevTime = ($timeline->shotStopFrame) ;
}
?>
[/PHP]
Comment