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 8570483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:34:06+00:00 2026-06-11T18:34:06+00:00

I’m working with the framework of a class I am developing, and I am

  • 0

I’m working with the framework of a class I am developing, and I am throwing tests at it before I finish it.

However, I’m getting several errors that appear to be interfering with its execution.

Here are the php warnings/errors:

Notice: A session had already been started - ignoring session_start() in
/var/www/VRC_Header2.php on line 2

Strict Standards: Redefining already defined constructor for class CheckOut in 
/var/www/CheckOut_old.php on line 18

And here are the two classes involved:

<?php //Checkout class - NOTE: Add exception handler later

class CheckOut extends DB_MySQL{

    public $fName;

    public $lName;

    public $numberOut;

    public $p_id;

     public function __construct($dbuser, $dbpass, $dbhost, $dbname) 
     {

        parent::__construct($dbuser, $dbpass, $dbhost, $dbname);

        $this->connect();

     }



    //Grab the values of the territory being checked out



    public function checkOut($numberOut)
    {

        $this->numberOut=$numberOut;

        /*
         *Begin checkout function that inserts into database.
         *Make sure all tests are run BEFORE calling this method.
         *Begin checkout function:
        */

        //Check Connection

        $this->checkConnect();

        //Start Checkout

        $stmt = $this->dbh->prepare("INSERT INTO checkOut(t_id, p_id, checkTime, due) VALUES(:param1, :param2, curdate(), date_add(curdate(), interval 3 month))");

        $stmt->bindParam(':param1', $this->numberOut);

        $stmt->bindParam(':param2', $this->p_id);

        $stmt->execute();


        if($stmt == FALSE)

                        return false;
        else

            return true;            
    }



    private function checkConnect()
    {

        if(!isset($this->dbh))

            $this->connect();

    }               

    public function territoryCheck($numberOut)
    {

        $this->numberOut = $numberOut;

        //Execute test

        $this->checkConnect();

        $stmt = $this->dbh->prepare("SELECT t_id FROM Territory WHERE t_id = :param1");

        $stmt->bindParam(':param1', $this->numberOut);

        $stmt->execute();           

        $stmt->fetch();


        //Determine value of test

        if($stmt == FALSE)
        {
            return FALSE;
        }   
    }



    public function publisherCheck($lName, $fName)
    {

        $this->lName = $lName;

        $this->fName = $fName;

        //Execute test

        $this->checkConnect();

        $stmt = $this->dbh->prepare("SELECT p_id FROM People WHERE lastName = :param1 AND firstName = :param2");

        $stmt->bindParam(':param1', $this->lName);

        $stmt->bindParam(':param2', $this->fName);

        $stmt->execute();



        //Determine value of test

        if($stmt == FALSE)
        {
            return FALSE;
        }
        else
        {

            $dummyvar = $stmt->fetch();
            $this->p_id = implode($dummyvar);
        }           
    }

    public function isTerritoryOut($numberOut)
    {
        //Execute test

        $this->checkConnect();

        $this->numberOut = $numberOut;

        $stmt = $this->dbh->prepare("SELECT t_id FROM checkIn WHERE t_id = :param1");

        $stmt->bindParam(':param1', $this->numberOut);

        $stmt->execute();

        $stmt->fetch();


        //Determine value of test

        if($stmt == FALSE)
        {
            return FALSE;
        }   
    }       
}   
?>

And the other:

include 'VRC_Header2.php';

class DB_MySQL {

    protected $dbuser;

    protected $dbpass;

    protected $dbhost;

    protected $dbname;

    protected $dbh; // Database connection handle       

    public function __construct($dbuser, $dbpass, $dbhost, $dbname)
    {

        $this->dbuser = $dbuser;

        $this->dbpass = $dbpass;

        $this->dbhost = $dbhost;

        $this->dbname = $dbname;
    }

    //Used to create connections - almost always called by execute()

    protected function connect()
    {

        try
        {

            $this->dbh = new PDO("mysql:host=$this->dbhost;dbname=$this->dbname",$this->dbuser,$this->dbpass);

        }
        catch(PDOException $e)
        {
            print "Error!: ".$e->getMessage()."<br/>";
                        die();
        }
    }       
}
?>

The classes aren’t complete, but they are functional. Now, I feel that the real issue is related to the constructor (they error of course). But here is a question I posted earlier regarding that issue and the answer I recieved: How will a child class constructor interact with a parent class constructor in php?.

What is going wrong here?

Any help is appreciated.

Edit: I should also add the values I pass to the class are not inserted into the database. I assume it is a result of the errors/

  • 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-11T18:34:08+00:00Added an answer on June 11, 2026 at 6:34 pm

    You may note that a space or a newline before the opening tag <?php will be sent.

    Strict Standards: Redefining already defined constructor for class
    CheckOut in /var/www/CheckOut_old.php on line 18

    Here, you are defining 2 constructors to your app : as you can see on the php doc, you have 2 ways to create constructors :

    1/ The __construct() magic method :

    class A
    {
      public function __construct()
      {
    
      }
    }
    

    2/ The class name itself, case insensitive :

    class A
    {
      public function a()
      {
    
      }
    }
    

    And you created __construct and checkout method in your class checkout.

    In your case :

      class A
      {
    
         public function __construct()
         {
           echo "ok construct()";   
         }
    
         public function a()
         {
           echo "ok a()";
         }
      }
    
     $test = new A();
    

    Will output :

    ok construct()

    But that’s a very ambiguous situation so PHP gives you this warning.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I know there's a lot of other questions out there that deal with this
I need a function that will clean a strings' special characters. I do NOT

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.