topical media & game development

talk show tell print

server-amf-login-DatabaseConnector.php / php



  <?php
  
  class DatabaseConnector
  {
          private host        = "localhost";
          private dbName        = "vuDB ";
          private user        = "root";
          private pass        = "root";
          
  
          private link        = null; //to store db link resource id
          
          function DatabaseConnector() 
          { 
          //leeg omdat de private variabelen al gedefineerd zijn
          }
          
          private function connect()
          {        //wordt gevuurd als er geen verbinding gevonden is, variabelen zijn alleen zichtbaar in de class
                  this->link = mysql_connect(this->host, this->user, this->pass);
                  mysql_select_db(this->dbName, this->link);
          }
          
Maak database connectie @acces private
returns: database link, to be used in other sql calls

  
          public function getConnection()
          {
                  if(this->link == null)
                  {
                          this->connect();
                  }
                  return this->link;
          }
  }
  ?>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.