I know same question is asked before, and I tried that solution too. So anyone before giving downvote, it's request to go through my question. So I am trying to show the array values using foreach function. When I try to var_dump that value, it is showing the correct value, but when I am trying to echo it's value, it is just showing a word 'Array' for each of the values. Why so? What am I missing?
index.php
<? $genders = $db->execute("select distinct(gender) from clothing where pid = 1); ?>
The above query get the values M and F.
<? foreach ($genders as $gender) { ?>
<p><? echo $gender['gen'] ?></p>
<? //var_dump($gender); ?>
<? } ?>
The echo shows result: Array Array and var_dump shows result: M F
What I am missing?
var_dump($gender).var_dump()would be. You should show that the actual, exact output is.