Jump to content

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


boostboards

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
Link to comment
Share on other sites

  • 1 month later...
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
Link to comment
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 ?
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.