boostboards Posted September 17, 2006 Share Posted September 17, 2006 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 getFatal 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 Quote Link to comment https://forums.phpfreaks.com/topic/21033-line-151-brokeplease-help-spot-bad-code/ Share on other sites More sharing options...
markbett Posted September 17, 2006 Share Posted September 17, 2006 we arent going to count to 150 so you best tell us what line that is Quote Link to comment https://forums.phpfreaks.com/topic/21033-line-151-brokeplease-help-spot-bad-code/#findComment-93367 Share on other sites More sharing options...
boostboards Posted September 17, 2006 Author Share Posted September 17, 2006 its pointed to in the quoted code abovelook for<---------------------------------------------------- line 151 :-\ Quote Link to comment https://forums.phpfreaks.com/topic/21033-line-151-brokeplease-help-spot-bad-code/#findComment-93370 Share on other sites More sharing options...
markbett Posted September 17, 2006 Share Posted September 17, 2006 http://www.codeguru.com/forum/showthread.php?t=319571 Quote Link to comment https://forums.phpfreaks.com/topic/21033-line-151-brokeplease-help-spot-bad-code/#findComment-93372 Share on other sites More sharing options...
boostboards Posted September 17, 2006 Author Share Posted September 17, 2006 [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 ;DNow I know where to get answers :P ::)Thank you ohh forum helper. Quote Link to comment https://forums.phpfreaks.com/topic/21033-line-151-brokeplease-help-spot-bad-code/#findComment-93378 Share on other sites More sharing options...
subzuk Posted November 7, 2006 Share Posted November 7, 2006 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! Quote Link to comment https://forums.phpfreaks.com/topic/21033-line-151-brokeplease-help-spot-bad-code/#findComment-121264 Share on other sites More sharing options...
subzuk Posted November 8, 2006 Share Posted November 8, 2006 Could anyone help me out with this one if boostboards isn't around?Thanks in advanceSubzuk Quote Link to comment https://forums.phpfreaks.com/topic/21033-line-151-brokeplease-help-spot-bad-code/#findComment-121846 Share on other sites More sharing options...
trq Posted November 8, 2006 Share Posted November 8, 2006 [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. Quote Link to comment https://forums.phpfreaks.com/topic/21033-line-151-brokeplease-help-spot-bad-code/#findComment-121849 Share on other sites More sharing options...
subzuk Posted November 8, 2006 Share Posted November 8, 2006 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 151I 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.ThanksSachie Quote Link to comment https://forums.phpfreaks.com/topic/21033-line-151-brokeplease-help-spot-bad-code/#findComment-121853 Share on other sites More sharing options...
roopurt18 Posted November 8, 2006 Share Posted November 8, 2006 $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 ? Quote Link to comment https://forums.phpfreaks.com/topic/21033-line-151-brokeplease-help-spot-bad-code/#findComment-121856 Share on other sites More sharing options...
subzuk Posted November 8, 2006 Share Posted November 8, 2006 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]ThanksSachie Quote Link to comment https://forums.phpfreaks.com/topic/21033-line-151-brokeplease-help-spot-bad-code/#findComment-121864 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.