The problem is that I want to use the fecth_array by calling the object and calling it what it shows is a message like this:
* Parse error: syntax error, unexpected 'public' (T_PUBLIC) in C: \ xampp \ htdocs \ www \ WEB Studios \ Studied Codes \ Prinick \ Prinick02 \ includes \ class.Conexion.php on line 12 *
<?php
class Acceso{
protected $user;
protected $pass;
public function __construct($usuario,$password){
$this->user = $usuario;
$this->pass = $password;
}
public function Login(){
$db = new Conexion();
$sql = $db->query("SELECT nombre,password FROM usuarios WHERE nombre='$this->user' OR password='$this->pass'; ");
$dato = $db->recorrer($sql);
if(strtolower($dato['nombre']) == $this->user and strtolower($dato['password']) == $this->pass){
session_start();
$_SESSION['user'] = $this->user;
header('location: acceso.php')
}else{
header('location: index.php?error=datos_incorrectos');
}
}
?>
class connection
<?php
class Conexion extends mysqli{
public function __construct(){
parent::__construct('localhost','root','','prinick');
$this->query("SET NAMES 'utf8';");
$this->connect_errno ? die("Error de la Conexion"): $x = "SE Conecto";
// echo $x;
unset($x);
}
}
public function recorrer($y){
return mysqli_fetch_array($y);
}
// $db = new Conexion();
?>