从php中的单行获取数据

时间:2018-01-10 08:14:04

标签: php mysql sql

我试图从单行获取数据,我得到了这个错误。

mysql_fetch_row() expects parameter 1 to be resource,

这是我的代码:

$message = "SELECT b_message FROM site_setting WHERE id = '1'";
$resultmessage = mysqli_query($conn, $message);
 $row = mysql_fetch_row($resultmessage);
 echo $row[0];

需要帮助

2 个答案:

答案 0 :(得分:0)

尝试使用mysqli_fetch_row()

$row = mysqli_fetch_row($resultmessage);
echo $row[0];

答案 1 :(得分:0)

$b_message=array();
$message = "SELECT b_message FROM site_setting WHERE id = '1'";
$resultmessage = mysqli_query($conn, $message);
 while($row = $resultmessage->fetch_assoc());
{
    $b_message[]=$row['b_message'];
}
print_r($b_message);