echo "row->name = '$row->name'"; //prints name correctly
我的字段名称
$next_row = db_query("select * from field_data_field_department d join taxonomy_term_data t on d.field_department_tid = t.tid where d.entity_id = $entityID and t.name = '$row->name'");
返回未找到的列:1054未知列'我的字段名称'在where子句''
如果我在MariaDB中运行查询,那么
select * from field_data_field_department d join taxonomy_term_data t on d.field_department_tid = t.tid where d.entity_id = 10568 and t.name = 'Name of my field';
答案 0 :(得分:0)
可能与您访问对象的事实有关
(一定要避免sql注入)并尝试使用concat
$next_row = db_query("select *
from field_data_field_department d
join taxonomy_term_data t on d.field_department_tid = t.tid
where d.entity_id = $entityID and t.name = '" . $row->name ."'");