PHP code snippet – How to fetch all column values ? <?php $gsent = $gbd->prepare("SELECT name, colour FROM fruit"); $gsent->execute(); /* Obtener todos los valores de la primera columna */ $resultado = $gsent->fetchAll(PDO::FETCH_COLUMN, 0); var_dump($resultado); ?> Curly hair, very fair, please share :)Click to share on Twitter (Opens in new window)Click to share on Facebook (Opens in new window)Click to share on Reddit (Opens in new window)Click to share on Telegram (Opens in new window)Click to share on WhatsApp (Opens in new window)Click to email a link to a friend (Opens in new window) Subash Chandran 23rd November 2021 Leave a Comment