Something wrong with code?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nemxu
Forum Newbie
Posts: 6
Joined: Wed Mar 17, 2010 12:14 am

Something wrong with code?

Post by nemxu »

Code: Select all

<?php
include_once "/home/bidding2/public_html/thetop10women.com/polls/booth.php";
$php_poll->set_comments_per_page(5); 
$php_poll->set_date_format("d/m/Y H:i"); 
$php_poll->data_order_by("time","desc");
echo $php_poll->view_poll_comments(5); 
echo $php_poll->get_comment_pages(5); 
?>
Is there something wrong with this code? I keep getting this error:

Fatal error: Call to undefined method poll::set_comments_per_page() in /home/bidding2/public_html/thetop10women.com/ukglamourmodels.php on line 72

Line 72 has nothing to do with the code....

Thanks
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: Something wrong with code?

Post by JakeJ »

Try this: (include_once "/home/bidding2/public_html/thetop10women.com/polls/booth.php");

Instead of: include_once "/home/bidding2/public_html/thetop10women.com/polls/booth.php";
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Something wrong with code?

Post by Christopher »

JakeJ wrote:Try this: (include_once "/home/bidding2/public_html/thetop10women.com/polls/booth.php");

Instead of: include_once "/home/bidding2/public_html/thetop10women.com/polls/booth.php";
Huh? Put parens around the whole thing????
(#10850)
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Something wrong with code?

Post by Christopher »

nemxu wrote:Is there something wrong with this code? I keep getting this error:

Fatal error: Call to undefined method poll::set_comments_per_page() in /home/bidding2/public_html/thetop10women.com/ukglamourmodels.php on line 72

Line 72 has nothing to do with the code....
What is on line 72 in the script "ukglamourmodels.php"? You showed some code, but did not say what file is was from.
(#10850)
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: Something wrong with code?

Post by JakeJ »

Sorry.. Brain fart. That's what I get for cutting, pasting and editing too quickly.

I meant: include_once ("/home/bidding2/public_html/thetop10women.com/polls/booth.php");
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: Something wrong with code?

Post by cpetercarter »

I don't think that adding brackets around the file name will make any difference.

The error is telling you that there isn't a method "set_comments_per_page" in the class "poll". You may have made a mistake in entering the name of the method - maybe it should be "comments_per_page" or something. If it isn't a spelling mistake, then the problem is that the class does not contain the method you want to use.

Seems to me that you are trying to use code devised by someone else. Can't the author of the code help sort out this problem?
ell0bo
Forum Commoner
Posts: 79
Joined: Wed Aug 13, 2008 4:15 pm

Re: Something wrong with code?

Post by ell0bo »

Do you need to do:

global $php_poll;

before you actually call the object. It doesn't make a lot of sense however, and I'm not familiar with the class you're implementing. Any chance you wanna send us what's in the file you're inclding?
Post Reply