<?php 

require 'db.php';

$sels = $con->query("select * from banner");
while($rows = $sels->fetch_assoc())
{
        $p['id'] = $rows['id'];
		$p['bannerimg'] = $rows['bimg'];
		$cat =  $con->query("select catname from category where id=".$rows['cid']."");
		if($row = $cat->fetch_assoc())
		$p['catname'] = $row['catname'];
		$cp[] = $p;
}

echo json_encode($cp);
?>