/*mulitple row results can be pulled from the database with get_results function and outputs an object which is stored in $result */
// echo “
"; print_r($result); echo "
“;
/* If you require you may print and view the contents of $result object */
echo “Quantidade de PI’s: “;
foreach($result as $row) /* wpdb class should not be called directly.global $wpdb variable is an instantiation of the class already set up to talk to the WordPress database */
{
echo $row->soma;
}
?>
get_results( “select “.$table_prefix.”gmp_marker_groups.title,count(“.$table_prefix.”gmp_markers.id) as soma from “.$table_prefix.”gmp_markers inner join “.$table_prefix.”gmp_marker_groups on “.$table_prefix.”gmp_markers.marker_group_id=”.$table_prefix.”gmp_marker_groups.id group by title”);
/*mulitple row results can be pulled from the database with get_results function and outputs an object which is stored in $result */
// echo “
"; print_r($result); echo "
“;
/* If you require you may print and view the contents of $result object */
echo “
Tipo | Quantidade |
---|---|
“.$row->title.” | “.$row->soma.” |
“;
?>