I am looking to store the database values which are already stored as id's and retrieve via a for each loop within an array.
I have tried something like this, but it is not working:
foreach ($list as $item)
{
$commaSeparated = implode(',' , $item['id');
}
echo $commaSeparated;
Where item['id']
is the specific column pulled out of the query. If I use the $list variable, then I am getting the full result of the query which I do not want.
But, my error results in this:
Warning: implode(): Invalid arguments passed
This is what has correctly returned what I need:
foreach ($list as &$id)
{
$listArr[] = $id['toolbar_id'];
$commaSeparated = implode(',' , $listArr)
echo $commaSeparated;