In ordinary php I don't have that kind of problem I think but in WP this is a different story. I have query and I want return one value from "liczba_wodo" column.
global $wpdb;
if (isset($_POST['submit'])){
$spr_liczbe_wodo = $wpdb->get_row ("select liczba_wodo from wp_ow_adres where adres='Street 12/6'");
foreach ( $spr_liczbe_wodo as $print ) {
echo $print->liczba_wodo;
echo 'Echo test';
}
}
}
Of course 'echo test' works fine. I think that "$spr_liczbe_wodo" is null or something. Thanks for help.
prepare
.Notice: Trying to get property of non-object in
var_dump()
on result give you?object(stdClass)#2711 (1) { ["liczba_wodo"]=> string(1) "2" }