Hello,
I am having trouble printing out data from a custom wordpress table. When I attempt to print out the results of a query all that is returned is a string with the word "Array".
Info as follows:
Table Name: wp_mbv_property
Relevant Fields Names: property_id (PK), property_address
Page: Using shortcode to call the function that this code here is within.
Plugin code:
$mbv_table_property = $wpdb->prefix."mbv_property";
$mbv_query = "
SELECT property_address
FROM $wpdb->prefix.mbv_property
WHERE property_id = '1'
";
$mbv_test = $wpdb->get_col($mbv_query,1);
printf('<pre>//'.print_r( $mbv_test ).'\\</pre>');
I have tried this also it with:
$mbv_test = $wpdb->get_results($mbv_query,OBJECT);
In both instances all that is returned to my page is the word Array.
There is only 1 property address with an ID of 1, so what am I missing?
I have also tried this to no avail either:
$mbv_properties = $wpdb->get_results($mbv_query, ARRAY_A);
$mbv_counter = 1;
foreach ($mbv_properties as &$value) {
printf($value.' | ');
$mbv_counter = $mbv_counter++;
printf('counter value: '.$mbv_counter.' ');
if ($mbv_counter == 10) {
printf('<br>');
}
}
I feel like there is something stupid that I am missing but I can't seem to figure out what....
All I need it to do is to print out the property address....
Any help would be greatly appreciated, I have been beating my head on this for way to long.
Thanks!
-Bob