2016-03-28 16:04
浏览 52


I am writing an Android app from which I have to retrieve the data from MySQL. But I am getting the wrong output.

The table name is blood and the structure is as follows

structure of the table

The php code is as follows


$city = "HYDERABAD";
$blood = "APOSITIVE";

$sql = "select name,blood,age,lastdonated,mobile,email,state,city,sex from blood where upper(blood) = '$blood' OR lower(blood) = '$blood' AND upper(city) = '$city' ORDER BY id DESC LIMIT 1000 ";

$res = mysqli_query($con,$sql);

$result = array();

while($row = mysqli_fetch_array($res)){

echo json_encode(array("feedAnegative"=>$result));



The output is


In the above json feed I should just get the data related to city = hyderabad. But I am getting all the records in the table where blood is APOSITIVE. Where is the error?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题