为什么我不能用mysqli_query从mysql db表中获取数据? [重复]

I am at prototype stage so I have error_reporting(-1); at my 1st row. Despite this, I have no php error but php prints 'could not get data'.

As I understood from php.net manual and stackoverflow similar cases, my $sorgula returns FALSE.

But why? Can you help, regards

//i am sure that i am connected to db
if ($sorgula = mysqli_query($dbc, "SELECT * FROM tb_yazilar ORDER BY kolon_sn"))
{
    while ($satir = mysqli_fetch_array($sorgula, MYSQLI_ASSOC)) 
    {
    echo $satir['kolon_yazar'].' - '.$satir['kolon_baslik'].' - '.$satir['kolon_yazi'].' - '.$satir['kolon_etiketler'].' - '.$satir['kolon_ytarihi'].' -  -  -  - ';
    }
}
else 
{
echo 'could not get data';
}

mysqli_close($dbc);
</div>

try to use mysqli_error in your code .

procedural example:

$sorgula = mysqli_query($dbc, "SELECT * FROM tb_yazilar ORDER BY kolon_sn")
           or error_log(mysqli_error($dbc));

I used this and it worked: without the if, once it extracts, go back and add the if. :)

require 'db.php';
$query = "SELECT * FROM thoughts";
$result = mysqli_query($conn, $query);
while($row=mysqli_fetch_assoc($result)) {
echo "<td>" . "TEXT: ". $row['text'] . "</td>";
}
mysqli_close($conn);