`
haohappy2
  • 浏览: 315167 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Drupal 7 db_query error

 
阅读更多

Please have a try and you will never see the error

$rows = array();
/*while($row = db_fetch_object($result)) {
	$rows[] = $row;
}*/
foreach ($result as $row) {
       $rows[] = $row;
return $rows;

Please also try to change those:

$result = db_query("select * from {files} where fid = %d", $val['_fid']);
while ($data = db_fetch_object($result)) {
      $thefile = $data;
}

to

$query = db_select('files', 'f')
  ->fields('f')
  ->condition('fid', $val['_fid']);
$thefile = $query->execute()->fetchObject();

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics