<?php 

require 'db.php';

$sels = $con->query("select * from rate_order");
while($rows = $sels->fetch_assoc())
{
    $cat =  $con->query("select rid,uid,order_date from orders where id=".$rows['oid']."");
	if($row = $cat->fetch_assoc())
	{
	    $cat1 =  $con->query("select name from rider where id=".$row['rid']."");
    	if($row1 = $cat1->fetch_assoc())
    	{
    	    $p['rider'] = $row1['name'];
    	}
    	$cat2 =  $con->query("select name from user where id=".$row['uid']."");
    	if($row2 = $cat2->fetch_assoc())
    	{
    	    $p['name'] = $row2['name'];
    	}
    	$date=date_create($row['order_date']);
	    $p['order_date'] = date_format($date,"d-m-Y");
	}
	$p['order_id'] = $rows['oid'];
    $p['rate'] = $rows['rate'];
	$p['message'] = $rows['msg'];
	$cp[] = $p;
}

echo json_encode($cp);
?>