I have a query and I need to use it twice, one I'm going to use fetchCollum
and another I'm going to use fetch(PDO::FETCH_ASSOC)
. That said, I can not apply a fetch
and then apply another fetch
, for example:
$tokenHash = $query->fetchColumn(10);
if($query->rowCount() === 0 || (hash_equals($tokenHash, $tokenGet) === FALSE)):
echo 'Token Inválido!';
header( "refresh:10;url=listarDados.php" );
exit;
else:
$row = $query->fetch(PDO::FETCH_ASSOC);
It ends up returning me as boolean false
. And to not have to do everything again and simply copy and paste, is there an alternative to repeating the same query just using different fetch's?