Public variable use in all functions using PHP class
<p>Suppose that I have the PHP code as below:</p>

<pre><code>class modual {
  public $glo;

  static public function SaveData($RDesTechni = 1,$RCapacity = 2){
    try{
      $sql = "INSERT INTO tblworkfaire VALUES('',$RDesTechni,$RCapacity)";
      $qry=mysql_query($sql) or die (mysql_error());
      $id = mysql_insert_id();
      $glo = $id;
    }
    catch(exception $e){
      echo $e;
    }
  }

  static public function ListData(){
    try {
      include("connectdb.php");

      $query = "SELECT * FROM tblworkfaire where id=".$glo;

      return $query;
    }
    catch(exception $e){
      echo $e;
    }
  }
}
</code></pre>

<p><strong>What I need:</strong></p>

<p>I want to get the <code>$id</code> to use in the function <code>static public function ListData()</code> but it does not work.</p>

<p><strong>Problems:</strong></p>

<p>It does not work it shows me the error <code>undefined $glo</code> How I fix this? Anyone help me please. Thanks.</p>
