mortezahei
دوشنبه 25 مرداد 1395, 17:59 عصر
این کد php هستش، چرا در خروجی فقط آخرین ردیف دیتابیس چاپ میشه؟
$response=array();
$result=mysql_query("select * from human");
if(mysql_num_rows($result)>0)
{ while($row=mysql_fetch_array($result))
{ $temp=array();
$temp["person_id"]=$row["person_id"];
$temp["person_name"]=$row["person_name"];
$temp["person_family"]=$row["person_family"];
$temp["person_semat"]=$row["person_semat"];
$temp["person_dakheli"]=$row["person_dakheli"];
$temp["person_mostaghim"]=$row["person_mostaghim"];
$response["human"]=array();
array_push($response["human"],$temp);
}
$response["h"]=1;
echo json_encode($response);}else{
$response["h"]=0;
$response["message"]="not found";
echo json_encode($response);}
?>
$response=array();
$result=mysql_query("select * from human");
if(mysql_num_rows($result)>0)
{ while($row=mysql_fetch_array($result))
{ $temp=array();
$temp["person_id"]=$row["person_id"];
$temp["person_name"]=$row["person_name"];
$temp["person_family"]=$row["person_family"];
$temp["person_semat"]=$row["person_semat"];
$temp["person_dakheli"]=$row["person_dakheli"];
$temp["person_mostaghim"]=$row["person_mostaghim"];
$response["human"]=array();
array_push($response["human"],$temp);
}
$response["h"]=1;
echo json_encode($response);}else{
$response["h"]=0;
$response["message"]="not found";
echo json_encode($response);}
?>