At first I'm sorry for posting duplicate question I always try to find answers and never to ask. But nothing solved my problem. I have a MySql DB with table named data
. I cannot change the table name. When I execute SELECT * FROM `data`
or SELECT * FROM data
in phpMyAdmin, the query works correctly but when I execute it in PHP script the query()
returns false
<?php
$conn = new mysqli('localhost', 'username', 'pswd', 'dbname');
if ($conn->connect_error) {
die('connection error');
}
$result = $conn->query("SELECT * FROM `data`");
var_dump($result);
echo "-".$conn->error."-";
I have looked at these questions:
Mysql query works in phpmyadmin but not in php (due to date)
Mysql query works in Phpmyadmin but not works in PHP
MySQL query working in phpmyadmin but not in php
and some others...