Skip to content

Instantly share code, notes, and snippets.

@Uriel29
Created May 11, 2015 20:36
Show Gist options
  • Save Uriel29/90b5062b98e847278444 to your computer and use it in GitHub Desktop.
Save Uriel29/90b5062b98e847278444 to your computer and use it in GitHub Desktop.
Listar tudo que tem em uma coluna com PHP.
<?php
$db = JFactory::getDBO();
$query = ( 'SELECT bairro FROM `#__cck_store_form_article` ' );
$db->setQuery($query);
$items = $db->loadObjectList();
foreach ($items as $item) {
$bairro= $item->bairro;
echo $bairro;
}
//conta o numero de itens da coluna bairro
$n = count($items);
echo($n);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment