2
require_once ('../configuration/data_conn.php');
ini_set('display_errors', 1);
error_reporting(E_ALL);

$sql = "
    SELECT  

    product.id,
    product.name,
    product.code,
    product.supplier,
    product.date_created,
    product.total

    FROM product";

$req_sql = $conn->prepare($sql);
$req_sql ->execute();
$data_sql = $req_sql ->fetchAll(PDO::FETCH_ASSOC);
print_r($data_sql);

I got only 3 fields :

[0] => Array
   (
    [id] => 1511
    [name] => mirror
    [code] => CD-13480

  )
[1] => Array
   (
    [id] => 1512
    [name] => chair
    [code] => CD-13481

  )

but when i use the same query in my database tool it works.

Im sure i have access to all these columns and i use in my php connection the same credentials to login to my database.

Thanks for any help.

1 Answers1

1

I had a problem with the column supplier that contains special characters, I added type char for this field and it works now.

    $sql = "
          SELECT  
          product.id,
          product.name,
          product.code,
          product.supplier :: char(100),
          product.date_created,
          product.total

    FROM product";

Thanks for your help.