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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:54:26+00:00 2026-06-10T10:54:26+00:00

Basically my problem is as follows. I put the following code in the browser

  • 0

Basically my problem is as follows. I put the following code in the browser
?phase=1&step=0&fot=false and I get a black page.

The Apache server errors are as follow

PHP Notice: Undefined index: true in C:\Program Files (x86)\Zend\Apache2\htdocs\Proj11\1.php on line 9

This one is expected as is the line } elseif ($_GET['true']) { $fOT = 'true'; } in the beginning.

PHP Notice: Undefined index: true in C:\Program Files (x86)\Zend\Apache2\htdocs\Proj11\1.php on line 138

This one is the same line as before but inside the __construct of phase2 class

PHP Notice: Undefined variable: fOT in C:\Program Files (x86)\Zend\Apache2\htdocs\Proj11\1.php on line 17

is the line $phase->stepFunction($fOT); at the top of the script…. it was defined so dunno why the error….

I don’t know why is not doing anything, I appreciate the help thx

Thank you guys!

            if (empty ($_GET['fot']) ) { 
                    $fOT = 'false'; 
                    } elseif ($_GET['true']) { $fOT = 'true'; }

            $phase = $_GET['phase'];        
            if(empty ($phase)){
                $phase = new phase1();
                $phase->start();
                } elseif ($phase = 1) {
                    $phase = new phase2();
                $phase->stepFunction($fOT, $_GET['step']);
                    }
                 class phase 1 { ... }

                    class phase2 {
        function __construct () {

        $dbFile = 'dbconfig.php';
        $this->dbFile = $dbFile;
        include_once ("$this->dbFile"); 


        $step = $_GET["step"];

        $username = $DB_USER;
        $password = $DB_PASS;
        $server = $DB_SERVER;
        $dbName = $DB_NAME;

        $this->step = $step;
        $this->dbFile = $dbFile;
        $this->username = $username;
        $this->password = $password;
        $this->server = $server;
        $this->dbName = $dbName;

        $db = new PDO ('mysql:host=' .$server.';dbname='.$this->dbName,$this->username,$this->password);

        $this->db = $db;

        if (empty ($_GET['fot']) ) { 
        $fOT = 'false'; 
        } elseif ($_GET['true']) { $fOT = 'true'; }

    $this->IDB = $this->handleDatabase( 1 );
    $this->IDB2 = $this->handleDatabase( 2);
    $this->IDB3 = $this->handleDatabase( 3);
        }



public function handleDatabase ($num = 1){
// Prepare SQL Statements
    $IDB1 = $this->db->prepare( 
         "CREATE TABLE pages (
          id int(11) NOT NULL auto_increment,
         subject_id int(11) NOT NULL,
          menu_name varchar(30) NOT NULL,
          position int(3) NOT NULL,
          visible tinyint(1) NOT NULL,
          content text NOT NULL,
          PRIMARY KEY  (id)
    )ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8");

    $IDB2 = $this->db->prepare("
        CREATE TABLE subjects (
          id int(11) NOT NULL auto_increment,
          menu_name varchar(30) NOT NULL,
          position int(3) NOT NULL,
          visible tinyint(1) NOT NULL,
          PRIMARY KEY  (id)
    )ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8");

    $IDB3 = $this->db->prepare("
        CREATE TABLE users (
          id int(11) NOT NULL auto_increment,
          username varchar(50) NOT NULL,
          hashed_password varchar(40) NOT NULL,
          PRIMARY KEY  (id)
    )ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8");

    $name = "IDB".$num;
return isset( $$name)?$$name:false;
}
//Set Option to True or False

function createTablePages ($fOT){

    $r1 = $this->db->query('SHOW TABLES LIKE \'page\'');
    if (count($r1->fetchAll()) > 0 && $fOT == 'false') {
        echo "The table PAGE exists";

    } elseif ($fOT == 'true') {
        $this->IDB->execute();
        echo "enteres";
                $this->stepFunction (1,false);
    }
}
function createTableSubjects ($fOT){

    $r2 = $this->db->query('SHOW TABLES LIKE \'subjects\'');
    if (count($r2->fetchAll()) > 0  && $fOT == 'false') {
        echo "The table SUBJECTS exists ";

    } elseif ($fOT == 'true') {

        $this->IDB2->execute();
        $this->stepFunction (2,false);

    }
}

function createTableUsers ($fOT){

    $r3 = $this->db->query('SHOW TABLES LIKE \'users\'');   
    if (count($r3->fetchAll()) > 0  && $fOT == 'false') {
        echo "The table USERS exists";
    } elseif ($fOT == 'true') {
        $this->IDB3->execute();
        echo "Would you like to populate all the tables?";
    }   
}


public function stepFunction ($fOT,$step){

switch ($step) {
    case 0: 
            $this->createTablePages ($fOT);
            break;
    case 1: 
            $this->createTableSubjects($fOT);
            break;
    case 2: $this->createTableUsers ($fOT);
            break;
    }


}

    }
  • 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-10T10:54:27+00:00Added an answer on June 10, 2026 at 10:54 am

    You cannot use variables defined within a method on the global scope.

    Change this and it will solve some errors

        $this->IDB = $this->handleDatabase()->$IDB;
        $this->IDB2 = $this->handleDatabase()->$IDB2;
        $this->IDB3 = $this->handleDatabase()->$IDB3;
    

    to

        $this->IDB = $this->handleDatabase( 1 );
        $this->IDB2 = $this->handleDatabase( 2);
        $this->IDB3 = $this->handleDatabase( 3);
    

    and function handledatabase to

    public function handleDatabase ( $num = 1){
    // Prepare SQL Statements
    $IDB1 = $this->db->prepare( 
         "CREATE TABLE pages (
          id int(11) NOT NULL auto_increment,
         subject_id int(11) NOT NULL,
          menu_name varchar(30) NOT NULL,
          position int(3) NOT NULL,
          visible tinyint(1) NOT NULL,
          content text NOT NULL,
          PRIMARY KEY  (id)
    )ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8");
    
    $IDB2 = $this->db->prepare("
        CREATE TABLE subjects (
          id int(11) NOT NULL auto_increment,
          menu_name varchar(30) NOT NULL,
          position int(3) NOT NULL,
          visible tinyint(1) NOT NULL,
          PRIMARY KEY  (id)
    )ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8");
    
    $IDB3 = $this->db->prepare("
        CREATE TABLE users (
          id int(11) NOT NULL auto_increment,
          username varchar(50) NOT NULL,
          hashed_password varchar(40) NOT NULL,
          PRIMARY KEY  (id)
    )ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8");
    
    $name = "IDB".$num;
    return isset( $$name)?$$name:false;
    }
    

    Or just set $this->IDB directly in the method:

    public function handleDatabase ( ){
    // Prepare SQL Statements
    $this->IDB  = $this->db->prepare( [...]
    

    There are also a few other issues

     $this->IDB3->execute;
    

    Wont do anything, change to:

     $this->IDB3->execute();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So basically my problem can be written in pseudo-code as follows: split the line
Basically my problem is with the page at http://wiki.diablocommunity.com/index.php?title=Tristram_Cathedral Please see the screen shots
Basically my problem is that i've adapted a piece of code found here http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/thread/62e70670-f306-4bb7-8684-549979af91c1
My problem is basically as follows. There is an instance of a class extending
Basically my problem is the next one... the following script connects a the DB
Im stuck with this little project in C# but basically my problem is this:
Okay guys, basically the problem I'm having is this. I've been assigned to write
I'm having a problem with the SetLength command. It's basically this problem: I work
My problem is basically the same than this one but on windows 7: How
The problem is basically this, in python's gobject and gtk bindings. Assume we have

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.