I am trying to write a function where I will get the id's from a table and then I want to have the all the id's in the array so that these id's used in another function to be processed. I wrote the below but it's not array method and also it's printing the id's twice. I searched online and they all suggest to use mysql_fetch_assoc and remove for each..but in my case I am using the zend adapter fetchAll to get the output. Please let me know how I can get the id's in the array and also only once so that I can pass this array and each id is processed one by one..right now with what I have is just stopping after the first one is processed. Thanks.
function getID()
{
$sql = 'SELECT user_id FROM users WHERE ready = "1" ';
$idList = $this->getAdapter()->fetchAll($sql);
if(!empty($idList)) {
foreach($idList as $value) {
echo $value['user_id']."\n";
}
}
}
Output
201
223
231
334
201
223
231
334