Jump to content


Photo

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


  • Please log in to reply
10 replies to this topic

#1 boostboards

boostboards
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 17 September 2006 - 02:33 AM

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

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));
		}
	    }																							    
       }
Thanks in advance.

-Dave

#2 markbett

markbett
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 17 September 2006 - 02:55 AM

we arent going to count to 150 so you best tell us what line that is

#3 boostboards

boostboards
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 17 September 2006 - 03:00 AM

its pointed to in the quoted code above
look for

<---------------------------------------------------- line 151

:-\

#4 markbett

markbett
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 17 September 2006 - 03:05 AM

http://www.codeguru....ad.php?t=319571

#5 boostboards

boostboards
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 17 September 2006 - 03:24 AM

http://www.codeguru....ad.php?t=319571

Hey thanks! That Other forum helped me!!  ;D ;D
Now I know where to get answers  :P  ::)
Thank you ohh forum helper.

#6 subzuk

subzuk
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 07 November 2006 - 11:24 PM

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!

#7 subzuk

subzuk
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 08 November 2006 - 11:23 PM

Could anyone help me out with this one if boostboards isn't around?

Thanks in advance
Subzuk

#8 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 08 November 2006 - 11:33 PM

Could anyone help me out with this one if boostboards isn't around?


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

#9 subzuk

subzuk
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 08 November 2006 - 11:41 PM

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;
      $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));
}
    }    
}

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

#10 roopurt18

roopurt18
  • Staff Alumni
  • Advanced Member
  • 3,749 posts
  • LocationCalifornia, southern

Posted 08 November 2006 - 11:50 PM

$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....ad.php?t=319571 ?
PHP Forms : Part I | Part II

JavaScript: Singleton

http://www.rbredlau.com

#11 subzuk

subzuk
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 08 November 2006 - 11:56 PM

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:

http://www.sachie.co.uk/function.txt

Thanks
Sachie




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users