Skip to content

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);
?>
See also  Python code snippet - How to change the title bar color in tkinter?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.