<?php
require_once 'config.php';
//$error=false;
$errors=array();
$cities=array();

 $query="SELECT * FROM offers WHERE merchant_name like '".$_GET['merchant_name']."%'";

$row = mysqli_query($con,$query);
     
    if (mysqli_num_rows($row) >= 1) {
		
			
		 while($r=mysqli_fetch_array($row)){
			$cities[]=['id'=>$r['id'],'merchant_id'=>$r['merchant_id'],'merchant_name'=>$r['merchant_name'],'offer_title'=>$r['title'],'price'=>$r['price'],'description'=>$r['description']];
			
			
		}   
		$errors['offers']=$cities;
		$errors['success']='offers data';
    } else {
        
		$errors['success']='There is no offers found';
    }
	echo json_encode($errors);
?>