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

$query='SELECT * FROM promotions ORDER BY id DESC ';

$row = mysqli_query($con,$query);
     
    if (mysqli_num_rows($row) >= 1) {
		//$r=mysqli_fetch_array($row)	;
			
		 while($r=mysqli_fetch_array($row)){
			 
			$cities[]=['id'=>$r['id'],'title'=>$r['title'],'image'=>$r['image'],'description'=>str_replace("\r\n","",strip_tags($r['description']))];
			
			// $cities['images']=$images;
			
			
		}   
		$errors['banners']=$cities;
		//$errors['product_images']=$images;
		$errors['success']='promotions data';
    } else {
        
		$errors['success']='There is no banners found';
    }
	echo json_encode($errors);
?>