admin管理员组文章数量:1336311
I have two different table in wordpress one is custom table and another is wp_usermeta
table.
one email
is matched from both table so i want to get data from both table using email address is matched. My query is:
$sql = "SELECT * FROM wp_usermeta,tbl_information
WHERE wp_usermeta.meta_value =
tbl_information.account_email AND
((wp_usermeta.meta_key = 'mycv') OR (wp_usermeta.meta_key = 'drivinglicence') OR
(wp_usermeta.meta_key = 'first_name') OR (wp_usermeta.meta_key = 'last_name') OR
(wp_usermeta.meta_key = 'address') OR (wp_usermeta.meta_key = 'nickname'))"
$infos = $wpdb->get_results($sql);
foreach ($infos as $u) {
$users[$a->user_id][$a->meta_key] = $a->meta_value;
}
foreach ($users as $u) {
<?php echo $u['first_name'].' '.$u['last_name'];?>
}
This is works but when i try to print tbl_information table data like one of the field is: account_name
So i try to print like <?php echo $u['account_name'];?>
But it wont work.
本文标签: phphow to get data from two different table from wordpress database
版权声明:本文标题:php - how to get data from two different table from wordpress database 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742264724a2443172.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论