I am trying to get this Query to work but something must be wrong with my query. I can pull all the data out but can't figure out how to pull out data that matches a specific username. This is built on wordpress with buddypress integration.
global $wpdb;
$ttm_username = bp_get_displayed_user_fullname();
$trackingData = $wpdb->get_results("SELECT * FROM `wp_shipping_numbers` WHERE `username` = $ttm_username ");
If you are getting the username with bp_get_displayed_user_fullname()
function, that returns you as a string value.
$wpdb->get_results(
"SELECT * FROM `wp_shipping_numbers` WHERE `username` = $ttm_username "
);
Use
$wpdb->get_results(
"SELECT * FROM `wp_shipping_numbers` WHERE `username` = '".$ttm_username."' "
);