First sorry if you think the question is stupid but im new in php.., so the question is: Is it okay to use foreach loop instead of while loop?
Here is an example of what I have in mind:
foreach(mysqli_query($db_connect, 'SELECT * FROM exampletable') as $row)
{
echo $row['exampleitem'];
}
It's working, but I'm not sure is it right, secure, slow and etc..