duanqian9503 2015-06-23 11:16
浏览 42
已采纳

mysqli_fetch_array()期望参数1为mysqli_result,第37行给出布尔值

/* * Slenderman * Connect to database * @ return bool (connection) */ function db_connect(){

$connection = ysqli_connect("localhost","slenderman","slenderman");
if(!$connection){
    return false;
}   
if (!mysqli_select_db($connection, "joblicious")) {
    return false;
}
return $connection;

}

function find_jobs(){ db_connect();

$select = "SELECT jobs.id,
                  jobs.location,
                  jobs.title,
                  jobs.company,
                  jobs.description,
                  jobs.url";
$from = "FROM jobs.id";  
$where ="WHERE jobs.id >0";

$query = $select.$from.$where;
$result = mysqli_query(db_connect(),$query);

 while ($row = mysqli_fetch_array($result)){
    echo $row['id'];
 }

}

find_jobs();

  • 写回答

4条回答 默认 最新

  • doumo0206 2015-06-23 12:03
    关注

    You are getting this error because your query is returning false results.

    • Another problem is you have written

    $from = "FROM jobs.id";

    I think your table name is jobs so replace it with job and check the result using :

    if(!empty($result)){

    }

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 找一个网络防御专家,外包的
  • ¥100 能不能让两张不同的图片md5值一样,(有尝)
  • ¥15 informer代码训练自己的数据集,改参数怎么改
  • ¥15 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
  • ¥20 MATLAB绘制两隐函数曲面的交线
  • ¥15 求TYPCE母转母转接头24PIN线路板图
  • ¥100 国外网络搭建,有偿交流
  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案