I'm learning REST API basic create, read, delete and update using pure PHP with no framework (i have no prior knowledge of REST API and this is my first time trying to get into it and learn it) and i have a strange problem with GET request not returning results with one property on and off when reading data,
read.php
<?php
  // Headers
  header('Access-Control-Allow-Origin: *');
  header('Content-Type: application/json');
  include_once '../../config/Database.php';
  include_once '../../models/Capteur.php';
  // Instantiate DB & connect
  $database = new Database();
  $db = $database->connect();
  // Instantiate capteur object
  $capteur = new Capteur($db);
  // Capteur read query
  $result = $capteur->read();
  // Get row count
  $num = $result->rowCount();
  // Check if any categories
  if($num > 0) {
        // Cat array
        $cap_arr = array();
        $cap_arr['data'] = array();
        while($row = $result->fetch(PDO::FETCH_ASSOC)) {
          extract($row);
          $cap_item = array(
            'id' => $id,
            'code_capteur' => $code_capteur,
            'etat' => $etat,
            'etab' => $etab,
            'created_at' => $created_at,
            'updated_at' => $updated_at
          );
          // Push to "data"
          array_push($cap_arr['data'], $cap_item);
        }
        // Turn to JSON & output
        echo json_encode($cap_arr);
  } else {
        // No Categories
        echo json_encode(
          array('message' => 'No Categories Found')
        );
  }
when i remove 'etab' => $etab it outputs data fine
This is my class: Capteur.php
<?php
  class Capteur {
    // DB stuff
    private $conn;
    private $table = 'capteurs';
    // Post Properties
    public $id;
    public $code_capteur;
    public $etat;
    public $etab;
    public $created_at;
    public $updated_at;
    // Constructor with DB
    public function __construct($db) {
      $this->conn = $db;
    }
    // Get Posts
    public function read() {
      // Create query
      $query = 'SELECT *  FROM ' . $this->table . '
                                ORDER BY
                                  created_at DESC';
      // Prepare statement
      $stmt = $this->conn->prepare($query);
      // Execute query
      $stmt->execute();
      return $stmt;
    }
    }
    ?>


