0"; $result = $connect->query($sql); $output = array('data' => array()); if($result->num_rows > 0) { // $row = $result->fetch_array(); $active = ""; while($row = $result->fetch_array()) { $productId = $row[0]; // active if($row[7] == 1) { // activate member $active = ""; } else { // deactivate member $active = ""; } // /else $button = '
'; // $brandId = $row[3]; // $brandSql = "SELECT * FROM brands WHERE brand_id = $brandId"; // $brandData = $connect->query($sql); // $brand = ""; // while($row = $brandData->fetch_assoc()) { // $brand = $row['brand_name']; // } $brand = $row[9]; $category = $row[10]; $imageUrl = substr($row[2], 3); $productImage = ""; $output['data'][] = array( // image $productImage, // product name $row[1], // rate $row[6], // quantity $row[5], // brand $brand, // category $category, // active $active, // button $button ); } // /while }// if num_rows $connect->close(); echo json_encode($output);