Andre Chenier Andre Chenier - 1 year ago 131
MySQL Question

Why can not I fetch data from mysql db table with mysqli_query?

I am at prototype stage so I have

at my 1st row. Despite this, I have no php error but php prints 'could not get data'.

As I understood from 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'].' - - - - ';
echo 'could not get data';


Answer Source

try use mysqli_error in your code .