0) { while ($r = mysql_fetch_assoc($select_response)) { $user_id = intval($r["id"]); } $query = "SELECT * FROM `ordered_products` WHERE `user_id` = $user_id"; $result = array(); $response = mysql_query($query) or $code = 10; while ($r = mysql_fetch_assoc($response)) { $i = array(); $i["id"] = intval($r["id"]); $i["name"] = $r["product_name"]; $i["sellerId"] = intval($r["seller_id"]); $i["quantity"] = intval($r["quantity"]); $i["price"] = intval($r["price"]); $i["date"] = $r["date"]; $i["time"] = $r["time"]; $i["unit_of_quantity"] = $r["unit_of_quantity"]; $i["number_of_unit"] = intval($r["number_of_unit"]); array_push($result, $i); } }else{ $code = 10; } if ($code == 10) header('HTTP/1.0 503', true); echo(json_encode($result)); ?>