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.