I needed to grab one full column of a database and only that column, and have it returned as an array. I was using $qarr1 = $stmt->fetchAll(PDO::FETCH_COLUMN);, which worked perfectly. I now need to pull a second column from that data and have it saved as a separate array, but I can’t use fetchAll() for this because of cursor problems. I am still brand new to PHP and don’t quite understand the whole concept of the cursor, and I’m having difficulty understanding the arguments for fetch(). Is someone able to explain what I could do instead of using fetchAll()?
I needed to grab one full column of a database and only that column,
Share
You could try using
$stmt->fetchAll(PDO::FETCH_ASSOC);but if you really want to avoid
fetchAll()then just loop through each row.