Turning result into array from columns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So I'm trying to pull id's and put them into an array. I know I need to
iterate through them, but it doesn't seem to turn into an array. Here's the
function that I'm trying:

function checkID($id) {
$q = sprintf("SELECT id FROM content");
$result = $this->query($q);

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$realones = $row['id'];
}

if(in_array($id,array($realones))) { return true; } else { return false; }
}

It's only grabbing the first row id and putting it into the array. It won't
put any of the other ones in. If I just echo $row['id'], it will show both
of them, just not put both of them into an array.

--
Dave W

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux