我有一个从Drupal6迁移到7网站的问题。我是PHP和MySQL的初学者,找不到解决问题的方法。
我正在纠结的代码如下:
$sql = "select ID_Speler from TB_Spelers where uid = ".$id;
$row = db_fetch_array(db_query($sql));
$speler = $row['ID_Speler'];
我总是得到一个“对未定义函数db_fetch_array()的调用”
非常感谢您的帮助。
最佳答案
在Drupal 7中使用:
$query = db_select('field_data_field_order_no', 'fdfon');
$query->addField('fdfon', 'entity_id', 'nid');
$query->addField('fdfnt', 'field_notification_type_value', 'type');
$query->join('field_data_field_notification_type', 'fdfnt', 'fdfon.entity_id = fdfnt.entity_id AND (fdfon.bundle = :fdfon_bundle AND fdfnt.bundle = :fdfnt_bundle)', array(':fdfon_bundle' => "order_notification_type", ':fdfnt_bundle' => "order_notification_type"));
$query->condition('fdfon.field_order_no_value', $order_id)->orderBy('fdfnt.entity_id', 'asc');
$result = $query->execute();
while ($records = $result->fetchAssoc()) {
...
}