Suppose that I have the PHP code as below:
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;
}
}
}
What I need:
I want to get the $id
to use in the function static public function ListData()
but it does not work.
Problems:
It does not work it shows me the error undefined $glo
How I fix this? Anyone help me please. Thanks.