Jump to content
Fórum Script Brasil
  • 0

Ajuda com mysqli_fetch_array em php


Themapa
 Share

Question

Abaixo segue o meu código em php e a imagem com o erro em anexo. 
Por favor, me ajudem.

 

<?php

class conexion{

    private $conexion; 
    private $server = "localhost"; 
    private $usuario = "root"; 
    private $pass = "";
    private $db = "juventude"; 
    private $user ; 
    private $password;


    public function __construct(){

        $this->conexion = new mysqli($this->server, $this->usuario, $this->pass, $this->db);

        if($this->conexion->connect_errno){

            die("Falha a conectar ao Banco de Dados MYsql: (". $this->conexion->connect_errno.")");


        }
    }

    public function cerrar(){

        $this->conexion->close();

    }


    public function login($usuario, $pass){

        $this->user = $usuario;
        $this->password = $pass;

        $query = "select nome, login, senha from cadastro where usuario = '".$this->user."' and password = '".$this->password."'";

        $consulta = $this->conexion->query($query);


        if($row = mysqli_fetch_array($consulta)){

            session_start();

            
            $_session['nom'] = $row['nome'];
            $_session['ape'] = $row['apellido'];


            echo "Logou"; 

        }else {

            echo "login ou senha errados"; 

        }

        

    }

}

?>

erro.png

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.6k
    • Total Posts
      646.2k
×
×
  • Create New...