php - Mysqli how to fetch all data -


i have query:

$q = "select sum(cena) total, month( datum ) mesec nakupi group mesec"; $po = $mysqli->query($q); $mesecna_prodaja = $po->fetch_assoc(); 

this query selecting monthly sales data database. if run same query in phpmyadmin correct results. sales months total sales in each month. problem is, $mesecna_prodaja after fet_assoc returning 1 result, last month ? how can fetch data, phpmyadmin ? tried fetch_all, it's not working (internal server error).

i not sure how looking @ results, need iterate through associative array fetched view results.

try described in php documentation.

/* fetch associative array */ while ($row = $po->fetch_assoc()) {     printf ("%s (%s)\n", $row["total"], $row["mesec"]); }  

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -