I’d like to have access to $lastID when calling raw Is there a way to do this?
public static $lastID;
public function raw($sql){
if(!$result = mysql_query($sql)){
throw new Exception("Could not perform query: " .mysql_error());
}
self::$lastID = mysql_insert_id();
return($result);
}
Edit: it is a class member, it is static.
The context isn’t clear as but it looks as though $lastID is a class memeber, in which case to access it from within methods of that class you should use:
The other issue I can see in your code is that this line will not work
As
$lastIDisn’t static. Either declare$lastIDas static (in which case its state will be shared across all objects of the class)Or use
$this->rather thanself::