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

$query="SELECT * FROM popupgroups ORDER BY id DESC";

$row = mysqli_query($con,$query);
   $query1='SELECT * FROM countries ';

$row1 = mysqli_query($con,$query1);
     
   
    if (mysqli_num_rows($row) >= 1) {
		//$r=mysqli_fetch_array($row)	;
			
		 while($r=mysqli_fetch_array($row)){
			 
			$cities[]=['id'=>$r['id'],'name'=>$r['group_name'],'group_name'=>$r['group_name'],'qr_no'=>$r['qr_no'],'status'=>$r['status'],'created_at'=>$r['created_at']];
			
			// $cities['images']=$images;
			
			
		} 
		
		 while($r1=mysqli_fetch_array($row1)){
			$cities1[]=['id'=>$r1['id'],'name'=>$r1['name']];
			
			
		}   
		$errors['countries']=$cities1;
		
		$errors['popupgroups']=$cities;
		$errors['categories']=$cities;
		//$errors['product_images']=$images;
		$errors['success']=true;
		$errors['message']='popupgroups data';
    } else {
        
		$errors['success']=false;
		$errors['message']='There is no popupgroups found';
    }
	echo json_encode($errors);
?>