I am working on web services. i am sending image url in response but it is not coming in right format.I need output like: "template":"http://localhost/restaurant/admin/images2.jpg"
my code is
header('Content-Type: application/json');
include("admin/common/connection.php");
$userId= $_GET['user'];
if(isset($userId))
{
$select="select * from menu_template_background where user_id='".$userId."'";
$query= mysql_query($select);
$fetch_row= mysql_fetch_array($query);
$url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$str= strripos($url , "/");
$sub=substr($url,$str);
$replace=str_ireplace($sub,"",$url);
$template=$replace."/admin/".$fetch_row1['template_url'];
$fetchmenuDesign= array("template"=>$template);
echo $menuDesign[]=json_encode($fetchmenuDesign);
}
when i am trying to hit the image url it is not working.please help me if there is something wrong in my code.