作者:mobiledu2502926333 | 来源:互联网 | 2023-10-09 20:34
I'm using Json to retrieve the info by webServices. I got a file on PHP to achieve it but the O/P format is different .
我使用Json来通过webServices检索信息。我有一个关于PHP的文件来实现它,但是O/P格式不同。
$sql=mysql_query("select phone1 from xxx where id='".$amp."'");
$respOnse= array();
while($row=mysql_fetch_array($sql))
{
// print_r($row);
$sql_query=mysql_query("select x,y,z from tblRepairQueue where phOneNo='".$row['phone1']."'");
while($row1=mysql_fetch_array($sql_query)){
$ackNo=$row1['ackNo'];
$repairStatus=$row1['repairStatus'];
$savedAt=$row1['savedAt'];
$response[]=array("ackNo"=>"$ackNo","repairStatus"=>"$repairStatus","savedAt"=>"$savedAt");
}}
print json_encode($response);
Actually I'm using this on IOS to decode using
实际上我在IOS上用这个来解码
NSMutableDictionary *userDetails = [NSJSONSerialization JSONObjectWithData:returnData
options:0 error:nil];
The O/p which I'm getting for
我要的O/p
NSLog(@"%@", userDetails);
NSLog(@ % @”,userDetails);
(
{
ackNo = "21031221201377 ";
repairStatus = "Closed and Complete";
savedAt = "0000-00-00 00:00:00";
}
)
I'm expecting is like [{}, {}]
我期望的是[{},{}]
[
{
ackNo = "21031221201377 ";
repairStatus = "Closed and Complete";
savedAt = "0000-00-00 00:00:00";
}
]
How to achieve it , I don't know much about PHP . So grateful if anyone's of suggestion .
如何实现它,我对PHP知之甚少。如果有人建议的话,我很感激。
2 个解决方案