I have been migrating from PHP 5 to 7 the code of my project, since mysql does not run on the server but mysqli, but I have a class and function that I have not managed to make it work since with the previous version of PHP if it worked, the code is as follows.
class Consultar_Grado{
private $consulta;
private $fetch;
function __construct($codigo){
$this->consulta = mysql_query("SELECT * FROM grado WHERE id=$codigo");
$this->fetch = mysql_fetch_array($this->consulta);
}
function consultar($campo){
return $this->fetch[$campo];
}
}
Since changing the statements to mysqli or trying other methods always sends errors, I hope you can help me, thanks.