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

$query='SELECT * FROM users WHERE id='.$_GET['merchant_id'];

$row = mysqli_query($con,$query);
     
    if (mysqli_num_rows($row) >= 1) {
		
			
		 while($r=mysqli_fetch_array($row)){
			$abc=mysqli_fetch_array( mysqli_query($con,"SELECT * FROM countries WHERE id=".$r['country_id']));
			$cities[]=['id'=>$r['id'],'merchant_name'=>$r['first_name'],'merchant_email'=>$r['email'],'merchant_logo'=>$r['profile_pic'],'phone'=>$r['phone'],'address'=>$r['address'],'city'=>$r['city'],'banner'=>$r['banner'],'whatsapp_no'=>$r['whatsapp_no'],'website'=>$r['website'],'country'=>$abc['name'],'description'=>$r['about_merchant']];
			
			
		}   
		$errors['merchant']=$cities;
		$errors['success']='merchants data';
    } else {
        
		$errors['success']='There is no merchants found';
    }
	echo json_encode($errors);
?>