I have seen the opencart function which can be used outside with html like
<?php
foreach ($categories as $category){
echo $category['image'];
}
?>
i would like to make a function like that in php which i can grab data from database and use it outside. may be it's an array so foreach statement is working on it.
like i have name and age in my database i would like to use it like this
<?php
foreach($peoples as $people){
echo $people['name'];
echo $people['age'];
}
?>
Thanks in advance