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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -