Call To Undefined Method DateTime - Add Method?

Oct 15, 2010

I am using php 5.2.9 as a part of xampp installation. I am using codeigniter framework for my webapp. When I call upon DateTime::add, the Call to undefined method error is displayed. My code is...

$date_now = new DateTime();
$formatted_date = $date_now->format('Y-m-d H:i:s');
$expiry_date = $date_now->add(new DateInterval('P1Y'));
The error being displayed is...
Fatal error: Call to undefined method DateTime::add() in C:webappsfirstsystemapplicationmodelsmodel_first.php on line 25

How can I resolve this? The DateTime::format method works fine here.

View 1 Replies


Class - Method Call Reports Error About Undefined Method

I believe my class is correct but when I try to echo the output of the class I get an error on line 28: the line " echo 'Your full name ...." is line 28.

echo 'Your full name is ' . $person->retrieve_full_name() . '.';

This is where I created the function "retrieve_full_name"

public function __retrieve_full_name() {
$fullname = $this->firstname . ' . ' . $this->lastname;
return $fullname;
}/* This ends the Full Name Function*/

the error I get is Fatal error: Call to undefined method stdClass::retrieve_full_name() in /home/mjcrawle/processlogin2.php on line 28

View 3 Replies

"Call To Undefined Method" Error When Calling Static Method From Parent

How is the correct way to call a child class method from a parent class if both are static?

When I use static classes it returns the error "Call to undefined method A::multi()", however when I use non-static methods there is no problem, for example:

class A {
public static function calc($a,$b) {
return self::multi($a, $b);


Is there a way to call a child static method without knowing its class name?

View 1 Replies

PDO: Call To Undefined Method DB::query()

Trying to get to hang of PDO but not having much fun at the moment. I bet it's something really simple as well.

EDIT: What would be a better way to go about doing this? i.e instead of wrapping it in a class?

// DB.class.php
class DB {
protected $db_name = "PDO";
protected $db_user = "root";
protected $db_pass = "root";


View 5 Replies

Call To Undefined Method Mysqli_stmt?

I am currently trying to convert my PHP Website statemets from the old mysql to mysqli and use prepared statements. I use Eclipse with PDT and a ZendDebugger on a Windows 7 OS with IIS 7. The following code produces the following error: Call to undefined method mysqli_stmt::bindParam()

$stmt = $GLOBALS['f_dbLink'] -> prepare("SELECT post_text, bbcode_uid
FROM phpbb3_topics t, phpbb3_posts p, phpbb3_users u
WHERE t.forum_id = ? AND t.topic_id = ?
AND topic_first_post_id = post_id AND topic_first_poster_name = username");
$stmt->bindParam(1, $GLOBALS['contentForumID']);
$stmt->bindParam(2, $GLOBALS['contentID']);
$stmt -> execute();

The $stmt is created successfully as far as I can tell from the Debugger.

View 4 Replies

Fatal Error: Call To Undefined Method?

I am having this error Fatal error: Call to undefined method RecursiveArrayIterator::fetch_array() on line 128

$hierachy = new hierachy;
$iterator = new RecursiveIteratorIterator(new recursiveArrayIterator($hierachy->getSamelevelNode($name1)));

View 1 Replies

Call To Undefined Method Database::prepare()

from [URL]


What have I done wrong, or was this example code wrong? Call to undefined method Database::prepare() on line 167

View 2 Replies

Error: Call To Undefined Method Foo::stuff() In

I'm trying to learn this MVC OOP thingie and I stumbled across a weird error:

Fatal error: Call to undefined method Foo::stuff() in ...

The code I have:
class Foo extends FooBase{
static $_instance;
private $_stuff;
public function getStuff($which = false){
if($which) return self::app()->_stuff[$which]; else return self::app()->_stuff;
public function setStuff($stuff){


So if I understand correctly, a getter function can not have arguments? Why? Or am I doing something wrong here?

View 1 Replies

Call To Undefined Method When It's Static And Exists?

php > require_once('System.php');
php > System::users();
PHP Fatal error: Call to undefined method System::users() in php shell code on line 1

This seems to happen both from interactive command-line and from the a simple script:

System.php is in the PHP include path - and includes properly:


View 2 Replies

Catching A Call To An Undefined Static Method?

I have a class which just contains static methods.If make a typo and call a method from that class that does not exist, how can I catch that error?

PHP Code:
class Foo {
static function bar (){}
function __call($method, $a = 0){[code]....

View 6 Replies

Call To Undefined Method SimpleXMLElement - Fatal Error

i am having a code which parses the xml text which is obtained from google search it used to working fine before , I think after updating my version infos it not working fine what might be the problem i am getting the following error Fatal error: Call to undefined method SimpleXMLElement::child_nodes() in /home/search.php in line 70 let me know how can i solve this problem This code is used in smarty And it gets the response string from curl.

View 2 Replies

Error: Call To Undefined Method Mysqli_stmt::query()

Possible Duplicate:Fatal error: Call to undefined method mysqli_stmt::query()

I'm getting the above error message, could you find out why?

$mysqli=new mysqli("localhost", "***", "***","***") or die($mysqli->connect_error);

function checklogin($username, $password){
global $mysqli;
$result = $mysqli->prepare("SELECT * FROM users WHERE username = ?");
$result->bind_param("s", $username);
if($result != false){

View 1 Replies

Fatal Error: Call To Undefined Method PDO::close()

i have got that error and the line was this :

public function __destruct() {

i use PDO, is this the problem, does the PDO driver don't recognize this function? if yes, what is its equivalent in PDO ?

View 5 Replies

Joomla Module Development To Get Call To Undefined Method?

I've been trying to get my first module to work, but keep getting Fatal error: Call to undefined method JDocumentRendererModule::isTuesday() and can't for the life of me figure out what is wrong. I think I followed all tutorials to the letter, however as I am not really comfortable with PHP,

Joomla Version 1.5.15
PHP 5.2.11 / 5.3.1 for testinghere is my code...

View 1 Replies

Fatal Error: Call To Undefined Method After Uploading On The Web?

I have some pages, which work fine locally(using WAMP and error_reporting E_ALL in php.ini), but once I upload them, I get the following error:

Fatal error: Call to undefined method DB::exists()

The method is there, and I don't know why it can't be seen.

View 5 Replies

Run GeneratePassword() - Error Call To Undefined Method Forgotpass

I am having problem with running generatePassword() Its comes up with the error: Call to undefined method forgotpass::generatePassword()

class forgotpass extends functions
function forgotpass($post) //For forgot password.
$newpass = $this->generatePassword(8);
$sql_select = "select * from tbladmin where admin_name = '".$post['username']."'";
$result_select = mysql_query($sql_select);

View 6 Replies

Error: Call To Undefined Method DOMElement::importNode() In

Somthing wrong here, dont seem to be able to merge XML DOMDocumet's I get the error, "Fatal error: Call to undefined method DOMElement::importNode() in C:xampphtdocsxmltestxmltest.php on line 27" can anybody help me put this code right...

// include required files
include 'XML/Query2XML.php';
include 'MDB2.php';
// prepare xml document
$dom = new DomDocument('1.0');


View 1 Replies

Error: Call To Undefined Method StdClass::display()

First, this is a smarty site. My job is to change the naming of some of the smarty files as well as other files, so the paths and all else is set right because the site worked before I started changing them. The site is loaded within a folder under the root folder. On the home page, or Public_html/Software Project/index.php I am getting this error.

Fatal error: Call to undefined method stdClass::display() in /home/russia6/public_html/Software Projects/Apex Framework/index.php on line 12
The index.php coding is


View 3 Replies

Fatal Error : Call To Undefined Method Log::setUserId() ?

I have a generic Logger class that looks like this:

class Logger {


public function add($userId, $siteId, $logTypeId, $message) {
$Log = LogMapper::create();


I have two other classes, LogMapper and Log, which Logger uses to write records to a database.I also have a mechanism that emails me when a fatal error occurs. I received the following in about a dozen emails: Call to undefined method Log::setUserId()

My application uses autoloading, and I first thought that may be the problem, but clearly the Logger class is being loaded, and so autoloading has not broken. The path for the Log class is correct in the autoloader...and clearly the Log class has been loaded--otherwise a "Class 'Log' not found" error would have been thrown.

View 6 Replies

Fatal Error: Call To Undefined Method Session?

Fatal error: Call to undefined method Session::ismod() in /home/a1535619/public_html/main.php on line 38

Code: [Select] ."[<a href="userinfo.php?user=$session->username">My Account</a>] "
."[<a href="useredit.php">Edit Account</a>] ";
echo "[<a href="admin.php">Admin Center</a>] "


View 5 Replies

XML_RPC_Response Fatal Error: Call To Undefined Method Kindof

I am new to php5 programming :)

I redirect users to another server to login. After they login
successfully, they will be redirected to test.php. The server provides
xml_rpc interface so I can communicate with it. After running my
scripts, I get this error:

Fatal error: Call to undefined method XML_RPC_Response::kindOf() in /
usr/share/PEAR/XML/RPC.php on line 1972

It seems it is these two lines that cause problems:

I do get some response from the server, though.

The followings are my scripts:



ini_set('display_errors', true);


$test=new cwl();





require 'XML/RPC.php'
ini_set('display_errors', true);

class cwl{

private $cwlURL;
private $xmlrpcPath;
private $appID;
private $appIDPassword;
private $cwlClient;
private $sessionTicket;
private $params;.....

View 3 Replies

Trying To Install Auth For CI: Call To Undefined Method CI_Loader::setdata()?

I have been trying to implement an auth system for Codeigniter. I wanted to save time, though it hasn't succeeded so far.The system I'm trying to implement is: [url].....

Currently I have some forms working, but the registration form generates a fatal error:

PHP Fatal error: Call to undefined method CI_Loader::setdata() in /Applications/MAMP/htdocs/CI+Login/system/application/controllers/auth.php on line 159

Anyone has got this system running?

EDIT:The code that generates the error is:

if ($this->config->item('auth_use_security_code'))
$data['countries'] = $this->Usermodel->getCountries();

The problem is that load does not contain a method named setdata, has it in a previous version of CI or what can I make of this?

View 1 Replies

Fatal Error: Call To Undefined Method Mysqli_stmt::fetch_array()

in this code i get the error: Fatal error: Call to undefined method mysqli_stmt::fetch_array()

What is the problem?

$search= "player";
($sql = $db->prepare('select job from jobs where job like ?'));
$sql->bind_param('s', $search);


View 2 Replies

Fatal Error: Call To Undefined Method SplFileInfo::getRealPath()?

I've got a client who has just set up a new VPN and is attempting to install my plugin.He's getting the following error:Fatal error: Call to undefined method SplFileInfo::getRealPath() on the commented line below. This appears to have something to do with the ZEND libraries. Any ideas what I should tell him to do?

View 1 Replies

Class - Uncaught SoapFault Exception: Call To Undefined Method?

I'm trying to make a very small SOAP system working, but I'm struggling with a (small) problem for a few days What I want to do: I want to do some things on a few variables, which I'm passing in a class. Problem: I want to use the incoming class on my server.php file as an Object. But that's not possible.My server PHP file:

class Lid
public $NumberOfYears; //this one is public for example purpose only

View 2 Replies

Fatal Error: Call To Undefined Method Date::shortYear()

This line of code:

echo "<strong> {$this->author->last} {$this->date->shortYear()}</strong> ...";

gives me this error: Fatal error: Call to undefined method Date::shortYear() in /f5/debate/public/libs/Card.php on line 22. Even though in Date.php (which is included in Card.php):

class Date {
public $day;
public $month;
public $year;
public function shortYear() {
return substr($this->year, -2);

View 2 Replies

Copyrights 2005-15, All rights reserved