3

我处于原型阶段,所以我error_reporting(-1);在第一排。尽管如此,我没有 php 错误,但 php 打印'could not get data'

正如我从 php.net 手册和 stackoverflow 类似案例中了解到的那样,我的 $sorgula 返回 FALSE。

但为什么?你能帮忙吗,问候

//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);
4

2 回答 2

0

尝试 mysqli_error在您的代码中使用。

程序示例:

$sorgula = mysqli_query($dbc, "SELECT * FROM tb_yazilar ORDER BY kolon_sn")
           or error_log(mysqli_error($dbc));
于 2013-02-05T19:40:52.763 回答
0

我使用了它并且它有效:没有if,一旦提取,返回并添加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);
于 2016-09-15T10:49:12.520 回答