This question already has an answer here:
- How can I access an array/object? 3 answers
array(1) { ["categories"]=> array(2) { [0]=> array(1) { [0]=> object(stdClass)#233 (4) { ["categoryid"]=> string(2) "19" ["categoryname"]=> string(7) "Science" ["authorname"]=> string(7) "avinash" ["description"]=> string(7) "Science" } } [1]=> array(1) { [0]=> object(stdClass)#234 (4) { ["categoryid"]=> string(2) "21" ["categoryname"]=> string(20) "Recipies around the " ["authorname"]=> string(7) "Kishore" ["description"]=> string(25) "Recipies around the World" } } } }
i am trying to access this string using foreach i want what i did is
<?php foreach($categories as $category){ ?>
<tr>
<td><?php echo $category->categoryid; ?></td>
<td><?php echo $category->categoryname; ?></td>
</tr>
<?php } ?>
getting error Trying to get property of non-object..
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire