Evening community,
I stuck at one problem, which I can't find solution for. I would appreciate if you could give me a piece of your advice. In brief, I wrote the following function in a php-file:
public function getCurrencyReal(){
$sql = "SELECT currency_real FROM currency WHERE currency_id = '4' limit 1";
$query = $this->db->query($sql);
$currency_real = $query;
return $currency_real->row;
}
After that I added the following code in another php file, that should generate XML-list:
$currency_real = $model_module_xmlcreator -> getCurrencyReal();
and
$out .= "<test>" . $currency_real . "</test>";
As a result I've received the following thing:
, saying "Array".
I've realized that I'm asking for an array even though I want to get info only from one field and I actually need a string. So I changed the code a bit to
$currency_real = json_encode($query);
return $currency_real;
I believe that I miss something simple, but I can't find what (the output should be just "33.00"). Pardon me if the question is silly, I've started studying PHP not much time ago.
All best


$this->db? Plain PDO or MySQLi do not have a->rowproperty like your thing seems to have. But based on your image (please post text not images) it is likely that you can accessreturn $currency_real->row['currency_real'](since that thing is known to be an array)var_dump($currency_real)is your friend when trying to debug problems like this.