while ($row = mysql_fetch_array($results)){
$row['fieldName']
}
$query = "SELECT SQL_CALC_FOUND_ROWS *
FROM realestate
INNER JOIN users ON id_user = users.id
LEFT JOIN pic ON id_realestate = realestate.id
{$place}
{$offer}
{$type}
{$price}
group by realestate.id
ORDER BY {$order}
LIMIT 0,10";
我有两张表users
和realestate
。两者都有字段id
。应该在上面的fileldname中获取id
表中的users
?
答案 0 :(得分:1)
您应该在查询中命名字段:如果您执行users.id AS user_id
,那么PHP将会看到user_id
字段。
当然,在这种特殊情况下并不重要,因为您有两个等效字段:id_user
和id_realestate
。