donglin6313
2018-05-09 01:00
浏览 24
已采纳

如何访问两个表之间的同一命名列

$askforuser=$db->query("SELECT u.*,ud.* FROM users u INNER JOIN user_detail ud ON ud.userid=u.id"); 
$askforuser1 = $askforuser->fetchAll(PDO::FETCH_ASSOC);

users and user_details tables have 'created_at' column.

When i go like:

    foreach ($askforuser1 as $udet) {
extract($udet);
echo $created_at;
}

I see nothing on the screen but if i

foreach ($askforuser1 as $udet) {
    extract($udet);
    echo $userid; // user_detail table output.
    echo $id; // users table output;
    }

So, how can i get the users' created_at or user_detail's created_at?.
Thanks

1条回答 默认 最新

相关推荐 更多相似问题