Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8692693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:22:04+00:00 2026-06-13T00:22:04+00:00

I got an error while running my code, it says call to a member

  • 0

I got an error while running my code, it says call to a member function getBallparkDetailsStartDate() on a non-object.

if($projectStatusId == ProjectStatusKeys::BALLPARK_ACTIVE) {
            $ballpark = $this->ballparkDetailsHandler->getBallparkDetailsByProjectId($projectId);               
            $projectDetails["startdate"] = $ballpark->getBallparkDetailsStartDate();
            $projectDetails["enddate"] = $ballpark->getBallparkDetailsEndDate();
            $projectDetails["projectid"] = $projectId;
            $projectDetails["name"] = $ballpark->getBallparkDetailsBookingRef();
            $projectDetails["status"] = ProjectStatusKeys::BALLPARK_ACTIVE; 
        }

I got the error in this line: $projectDetails[“startdate”] = $ballpark->getBallparkDetailsStartDate();

Here is my other code:

public function __construct($ballparkDetailsId, $project, 
        $ballparkDetailsBookingRef, 
        $ballparkDetailsStartDate, $ballparkDetailsEndDate, 
        $ballparkDetailsExpiryDate, $ballparkDetailsDescription, 
        $ballparkDetailsNotes) {
    $this->ballparkDetailsId = $ballparkDetailsId;
    $this->project = $project;
    $this->ballparkDetailsBookingRef = $ballparkDetailsBookingRef;
    $this->ballparkDetailsStartDate = $ballparkDetailsStartDate;
    $this->ballparkDetailsEndDate = $ballparkDetailsEndDate;
    $this->ballparkDetailsExpiryDate = $ballparkDetailsExpiryDate;
    $this->ballparkDetailsDescription = $ballparkDetailsDescription;
    $this->ballparkDetailsNotes = $ballparkDetailsNotes;
}

public function getBallparkDetailsId() {
    return $this->ballparkDetailsId;
}

public function getProject() {
    return $this->project;
}

public function getBankName() {
    return $this->getProject()->getBankName();
}

public function getBankRef() {
    return $this->getProject()->getBankRef();
}

public function getRegionName() {
    return $this->getProject()->getRegionName();
}

public function getProjectStatusName() {
    return $this->getProject()->getProjectStatusName();
}

public function getBallparkDetailsBookingRef() {
    return $this->ballparkDetailsBookingRef;
}

public function getBallparkDetailsStartDate() {
    return $this->ballparkDetailsStartDate;
}

public function getBallparkDetailsEndDate() {
    return $this->ballparkDetailsEndDate;
}

public function getBallparkDetailsExpiryDate() {
    return $this->ballparkDetailsExpiryDate;
}

public function getBallparkDetailsDescription() {
    return $this->ballparkDetailsDescription;
}

public function getBallparkDetailsNotes() {
    return $this->ballparkDetailsNotes;
}

public function getProjectId() {
    return $this->getProject()->getProjectId();
}

public function getProjectStatusId() {
    return $this->getProject()->getProjectStatusId();
}

}
?>

The last time I check this it ran well. But now I don’t know what’s wrong with this? Please help me find the error. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:22:05+00:00Added an answer on June 13, 2026 at 12:22 am

    Apparently

    $ballpark = $this->ballparkDetailsHandler->getBallparkDetailsByProjectId($projectId);
    

    is not returning a “ballpark” at all. Probably it is returning an error, or something like an empty array.

    Try var_dump()‘ing $ballpark immediately before the line that raises the error, and see what it contains (probably False, NULL, array() or something equally un-ballparky.

    Then, inspect the ballparkDetailsByProjectId() function in the BallparkDetailsHandler.php file. At a guess, you might be passing an invalid (i.e. nonexistent, removed, etc.) $projectId.

    Then you might rewrite the code with error checking:

    if($projectStatusId == ProjectStatusKeys::BALLPARK_ACTIVE) {
            $ballpark = $this->ballparkDetailsHandler->getBallparkDetailsByProjectId($projectId);
            if (!is_object($ballpark))
                trigger_error("Error: bad project ID: '$projectId': $ballpark",
                    E_USER_ERROR);
    
            $projectDetails["startdate"] = $ballpark->getBallparkDetailsStartDate();
            $projectDetails["enddate"] = $ballpark->getBallparkDetailsEndDate();
            $projectDetails["projectid"] = $projectId;
            $projectDetails["name"] = $ballpark->getBallparkDetailsBookingRef();
            $projectDetails["status"] = ProjectStatusKeys::BALLPARK_ACTIVE; 
        }
    

    Then in the BallparkDetailsHandler.php file you could modify this code:

    // Prepare query or die
    if (!($stmt = $this->mysqli->prepare($query))
        return "Error in PREPARE: $query";
    
    $stmt->bind_param("i", $projectId);
    $stmt->execute();
    $stmt->store_result();
    $stmt->bind_result($ballparkDetailsBookingRef, $bankRef, $regionName,
         $projectStatusId, $projectStatusName,  $ballparkDetailsDescription,
         $ballparkDetailsNotes, $ballparkDetailsStartDate, $ballparkDetailsEndDate,
         $ballparkDetailsExpiryDate);
    $stmt->fetch();
    
    // If no data, then die
    if(!$stmt->num_rows)
        return "No data in DB for projectID '$projectId': $query";
    
    // Should be clear sailing from here on. Actually I ought to check
    // whether all these new() here do return anything sensible, or not
    
    $bank = new Bank("", "", $bankRef, "");
    $region = new Region("", $regionName, "");
    $projectStatus = new ProjectStatus($projectStatusId, $projectStatusName);
    $project = new Project($projectId, $bank, $region, $projectStatus);
    
    return new BallparkDetails("", $project,
        $ballparkDetailsBookingRef, $ballparkDetailsStartDate, 
        $ballparkDetailsEndDate, $ballparkDetailsExpiryDate, 
        $ballparkDetailsDescription, $ballparkDetailsNotes);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got the following error while running my perl script with the negative lookaround
I got an error: e is undefined on my javascript slider code when running
I have got this Runtime Error when running this code: void AlienShipManager::Update(float timeDelta, BulletManager*
i got this error while trying to rebind a grid: ( Parent page (
Got this error message while trying to load view: The model item passed into
Got this error message while trying to configure an entitydatasource in the designer: My
I got the following error while trying to alter a column's data type and
I got this error An error occurred while parsing EntityName. Line 1, position 61.
i got 'JQuery' is undefined error while browsing the page in IE 6 but
I got RJS error: TypeError: element is null while using ajax. I used in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.