0
I have a page that makes connection through the mode mysqli class below:
# include da classe
class connectionClass extends mysqli{
public $host="localhost",$dbname="banco",$dbpass="",$dbuser="susus";
public $con;
public function __construct() {
if($this->connect($this->host, $this->dbuser, $this->dbpass, $this->dbname)){}
else
{
return "<h1>Erro de conexão/h1>";
}
}
}
page where it is called the class
require_once 'connectionClass.php';
class webcamClass extends connectionClass{
$query = "INSERT INTO vis_pres_path_foto (fk_id_user_sistema,vis_pres_path_foto_image) ";
$query .= "VALUES('$id_user','$image') ";
$result = $this->query($query);
}
Like I do after the insert
above return the last
id
of the table after the insert
in the PDO I use $ultimo = $conn->lastInsertId();
but, for this case does not work.
first notice that your if and Else are within the same key, fix it in your code because the correct syntax is if { parametres } Else { parametres } and not in the way you indicate if{ parametres ... Else {} {
– Victor
$this->insert_id
– arllondias