his is not working can anyone help please?
(count($stmt->fetchAll()) > 1) ? $result = $stmt->fetchAll() : $result = $stmt->fetch();
print_r($result);
his is not working can anyone help please?
(count($stmt->fetchAll()) > 1) ? $result = $stmt->fetchAll() : $result = $stmt->fetch();
print_r($result);
Copyright © 2021 Jogjafile Inc.
All the
fetchXYZ
methods advance the underlying cursor, so once you've called them, you cannot "go back" and get the same rows again.You could redo your condition in-memory, after calling
fetchAll()
only once: