Jump to content

Archived

This topic is now archived and is closed to further replies.

boostboards

line 151 broke.....please help spot bad code

Recommended Posts

I have a couple errors to deal with in a script and this one is bugging me the most. Is something missing from this code?
-----edit----
The error I get

Fatal error: Call to a member function on a non-object in /home/user/public_html/videos/include/function.php on line 151

[code]function video_to_frame($fpath,$name,$mov,$chnl)
{ <----------------------------------------------------------------------line 151
       global $config;
        $frcount=$mov->getFrameCount();
if ($frcount > 0)
{
        $ff_frame[1]= $mov->getFrame(rand(3,$frcount));
        $ff_frame[2]= $mov->getFrame(rand(5,$frcount));
        $ff_frame[3]= $mov->getFrame(rand(7,$frcount));
    for($i=1;$i<=3;$i++)

    {
while (!$ff_frame[$i])
{
    $ff_frame[$i]= $mov->getFrame(rand((2*$i+1),$frcount));
}
    }    
} else {       
    $ff_frame[1]= $mov->getFrame(rand(3,40));
        $ff_frame[2]= $mov->getFrame(rand(5,40));
        $ff_frame[3]= $mov->getFrame(rand(7,40));
    for($i=1;$i<=3;$i++)
    {
while (!$ff_frame[$i])
{
    $ff_frame[$i]= $mov->getFrame(rand((2*$i+1),$frcount));
}
    }    
       }[/code]
Thanks in advance.

-Dave

Share this post


Link to post
Share on other sites
[quote author=markbett link=topic=108357.msg435889#msg435889 date=1158462315]
http://www.codeguru.com/forum/showthread.php?t=319571
[/quote]
Hey thanks! That [i]Other[/i] forum helped me!!  ;D ;D
Now I know where to get answers  :P  ::)
Thank you ohh forum helper.

Share this post


Link to post
Share on other sites
Hi boostboards,

it looks like you are using the same script as me. Can you tell me how you fixed the problem? Sorry I'm a complete newbie!

Share this post


Link to post
Share on other sites
Could anyone help me out with this one if boostboards isn't around?

Thanks in advance
Subzuk

Share this post


Link to post
Share on other sites
[quote]Could anyone help me out with this one if boostboards isn't around?[/quote]

It might help if you actually post some code and tell us what [i]your[/i] problem is.

Share this post


Link to post
Share on other sites
Hi thorpe,

Its the same error that boostboards had.

The error code I get is: Fatal error: Call to a member function on a non-object in /home/user/public_html/videos/include/function.php on line 151

I have highlighted the line in red.


function video_to_frame($fpath,$name,$mov,$chnl)
{
        global $config;
      [b][color=red] $frcount=$mov->getFrameCount();[/color][/b]
if ($frcount > 0) {
        $ff_frame[1]= $mov->getFrame(rand(3,$frcount));
        $ff_frame[2]= $mov->getFrame(rand(5,$frcount));
        $ff_frame[3]= $mov->getFrame(rand(7,$frcount));
    for($i=1;$i<=3;$i++)
    {
while (!$ff_frame[$i])
{
    $ff_frame[$i]= $mov->getFrame(rand((2*$i+1),$frcount));
}
    }    
}

I know that a link was posted to another site but as I am so new to this it doesn't really help me.

Any help would be most appreciated.

Thanks
Sachie

Share this post


Link to post
Share on other sites
$mov is used in line 151 as if it is an object.  Your code is breaking because what you're passing to the function for $mov is not an object.

Try posting the line that calls the function as well as the previous 10 lines or so.

And did you read anything previously posted over at http://www.codeguru.com/forum/showthread.php?t=319571 ?

Share this post


Link to post
Share on other sites
Hi roopurt18,

Yes I did look at the link that was given earlier and did try to fix the code but to no avail. I am pretty much completely new to php. I will however be sure to start reading the big fat book on my desk and learning it soon. The first mention of $mov was in the lines that I posted. I have uploaded the file here for you to see:

[url=http://www.sachie.co.uk/function.txt]http://www.sachie.co.uk/function.txt[/url]

Thanks
Sachie

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.