title: just one mysql connection in the all project
body: <p>i want to know if there is a way that always i have one opened connection into my database.
  i'm using this codes in my sites :</p>
  
  <p>mysql class</p>
  
  <pre><code>class Mysql{
  public static $Server   = "localhost";
  static $User = 'root';
  static $Password = '';
  static $DataBaseName = 'teca.v1';
  static $Connection;
  static $DataBase;
  static $LoadConnection = 0;
  static $CharSet = "utf8";
  
  static $TRANS =false;
  static $TRSS  = array();
  
  public function __construct(){
      if(Mysql::$LoadConnection==0){
          Mysql::$Connection = mysql_connect(Mysql::$Server,Mysql::$User,Mysql::$Password);
          Mysql::$DataBase   = mysql_select_db(Mysql::$DataBaseName,Mysql::$Connection);
          $charset=Mysql::$CharSet;
          mysql_query("SET NAMES $charset");
          Mysql::$LoadConnection=1;
      }
  }
  }
  </code></pre>
  
  <p>model class</p>
  
  <pre><code>class Model extends Mysql{
  protected $datamembers = array();
  protected $PrimaryKey="Id";
  protected $TableName ="Table";
  public $UnProtectedExecute = FALSE;
  
  public  function ReadyString($value)
  {
      if($this-&gt;UnProtectedExecute == TRUE)
          return addslashes($value);
      else
          return $value;
  }
  public function __set($variable, $value){
      $this-&gt;datamembers[strtolower($variable)] = $value;
  }
  
  public function __get($variable){
      return $this-&gt;datamembers[strtolower($variable)];
  }
  </code></pre>
  
  <p>and one of my objects :</p>
  
  <pre><code>class LibraryFiles extends Model{
      public $TableName   = 'library_files';
  }
  </code></pre>
  
  <p>but i dont know is this right and just this code create 1 connection for all of the object in my project?</p>