im trying to pass a url to fetch data for android JSON.
网址是: fetch_cat_url =“xxx / get_product_details.php?task_name = get_cat& cat_name =”+ cat_name;
where cat_name="Books & More"
now when i pass this url.. it goes like
xxxxx/get_product_details.php?task_name=get_cat&cat_name=Books & More
in my sql file
switch($_GET["cat_name"])
{
case "Fashion":
$sql = "SELECT * FROM `category` where c_name IN (\"Men\",\"Women\" ,\"Baby & Kids\") ";
break;
case "Home & Living":
$sql = "SELECT * FROM `category` where c_name IN (\"Kitchenware\", \"Home Furnishing\", \"Home Decoratives\", \"Furniture\") ";
break;
case "Books & More":
$sql = "SELECT * FROM `category` where c_name IN (\"Academic Text\", \"Literature & Fiction\", \"Non Fiction\", \"Self Help\", \"Children & Young Adult\", \"Competitive Exam\") ";
break;
case "Automotives":
$sql = "SELECT * FROM `category` where c_name IN (\"Car Accessories\", \"Helmets & Accessories\", \"Car & Vehical Electronics\", \"Car Freshners\", \"Spare Parts\") ";
break;
}
now for & the data is not returned in json.. but it returns for rest all categories...
时尚和汽车的数据回归,但书籍和家庭没有数据
答案 0 :(得分:0)
从客户端cat_name
传递json
时,请确保json
字符串应按此编码。
String jsonString = Uri.EncodeDataString(json)
现在只需将jsonString
传递给服务器..
可能会有所帮助。