If you need to return one value then use get_var
instead of get_row
. get_var
will return a string. get_row
will return an array or object.
$spr_liczbe_wodo = $wpdb->get_var ("select liczba_wodo from wp_ow_adres where adres='Street 12/6'");
var_dump($spr_liczbe_wodo);
The problem with your code, by the way, is that $spr_liczbe_wodo
is an object, but when you loop over it $print
is not but you attempt to use it as if it were an object anyway. Through in a couple of var_dump
s and you can easily see the problem.