Identify users and show their profiles

0

I am creating a user system that shows the profile of each one, I only show mine and the main objective is to see the other profiles of all registered users, something similar to facebook, try to do it with sessions and according to the id of the BBDD, but only show my information always.

     public function author(){

  try{

  if($_SESSION['id_user']!=$_SESSION['author']){

         $read_user = $this->BBDD->prepare("SELECT * FROM usuarios WHERE id = ?");
         $read_user->execute(array($_SESSION['author']));
         $read_response = $read_user->fetchAll(PDO::FETCH_OBJ);       
         $this->BBDD = NULL;
    //header("location:../dashboard.php");
        return $read_response;
    }
    //$this->id_author = $_SESSION['id'];


  } catch (PDOException $ex) {
      die("Error al leer este usuario" . $ex->getCode() . PHP_EOL . " " . $ex->getMessage() . PHP_EOL . $ex->getLine());
  }

}

This code does not work for me since the user always has to take an action to create the author variable, and what I really want is to only show his profile from other users and not mine.

    
asked by Carlos Estarita 01.02.2017 в 17:58
source

1 answer

0

Well then, access your database, access the table that contains the registered users, there will be a list with registered users, there will show you all the data of each user, but if you want something more advanced and personalized, search the internet for some tables that are already made only to download and edit the files in a way that makes them connect to your database effectively

    
answered by 01.02.2017 / 18:19
source