I hope to get some help on a problem that I suppose must be simple but I have been stuck for a while.
I have a simple Mysql table with 3 fields ( id, customer, sales ) . All I need is to query this table and get an php array.
Here's my code:
$query = "SELECT * FROM mysqltable";
$result = $mysqli->query($query))
I need to write a code to loop and get an array in this format:
$row=array(0=>"500,200",1=>"500,300",2=>"1000,600",3=>"800,400",4=>"200,500");
So I can end with
echo json_encode($row);
Would appreciate any help to solve this.
while ($row = $result->fetch_object()){ $row->sales }
– Peter Jan 28 '13 at 3:05