database query retuyrns fields in one order, I want to display them in
another
This probably has been answered (or should be basic knowledge), so please
forgive the noob question...
I'm using the WP user_meta database to store advanced properties of a user.
Data is stored in this order (this is all for userid=15):
city = Altoona
state = PA
phone = 9999999999
name = Fred
I want to generate the output as
Fred, Altoona, PA, 9999999999
Here's the relevant PHP code:
$my_exportlist = $wpdb->get_results("SELECT `user_id` FROM
`wp_m_membership_relationships` WHERE `level_id` = '2' ");
foreach ($my_exportlist as $duser) {
$my_stationinfo = $wpdb->get_results("SELECT * FROM `wp_usermeta` WHERE
`meta_key` IN ('name', 'city', 'state', 'office') AND user_id
='$duser->user_id'");
foreach ($my_stationinfo as $myinfo) {
$csv_output .= $myinfo->meta_value . ",";
}
$csv_output .= "\n";
}
No comments:
Post a Comment