This is puzzling the hell out of me .. Simple fetch & loop isn't displaying any data There is data in the table as displaying the result outside the loop returns data
$dbc = mysqli_connect($dbh, $dbu, $dbp, $dbn);
$query = mysqli_query($dbc,"SELECT * FROM `products`");
$res = mysqli_fetch_assoc($query);
$rows = array();
do {
$rows[] = $res['product'];
}while($res = mysqli_fetch_assoc($query)) ;
$data = json_encode($rows);
echo $data;
echo mysqli_error($dbc);
ADDED :
returns the data in the array
<pre>Array
(
[ID] => 1
[list_name] => Dry Fruits
[cat] => Dry Fruits and Nuts
[item_code] => 1049
[pack_style] => 106
[packstyle_active] => Y
[style_desc] => Stabilo250
[system_wt] => 0.25
[weight_desc] => 250gm
[declared_weight] => 0.25
[declared_weight_desc] => 250gm
[uom] => gm
[qty_in_case] => 1
[case_size] => 1 x 250gm
[product] => Almond Sliced
[weight_code] => 126
[qty_code] => 00
[product_code] => 1049-106-126-00
[barcode] => 502185878567
[barcode13] => 5021858785678
[sequence_no] => 78567
[sage_code] => 104978567
[active] => N
[allergen] => Y
[origin] => Various
[density] => 0
[processtype] => PT32
[processed_by] => FGS
[Industrial] => N
[Catering] => N
[RetailEthnic] => Y
[RetailMainstream] => N
[Website] => N
[Special] => N
[zohoitemcode] => 1540890000001353073
)
So I think its an issue with the json_encode.. maybe
print_r($rows)
Array
(
[0] => Almond Sliced
[1] => Almond Sliced
[2] => Almond Sliced
[3] => Almond Sliced
[4] => Almond Sliced
[5] => Almond Sliced
[6] => Almond Sliced
[7] => Almond Sliced
[8] => Almond Sliced
[9] => Almond Sliced
[10] => Almond Sliced
[11] => Almond Sliced
[12] => Almond Sliced
[13] => Almond Sliced
[14] => Almond Sliced
[15] => Almond Sliced
)
There is over 36000 records of products