This is the header information sent.
This is the response data
This is the data printed on the background page.
The last code to post in the background:
if($_POST['idp']){ //如果地址栏中有idp,则通过idp获取产品信息;否则根据当前时间获取(取最近有的数据) $idp = $_POST['idp']; $sql = "SELECT * FROM `product` WHERE id={$idp}";}else{ //如果没有idp ,则获取最近期的产品信息 $sql = "SELECT * FROM `product` ORDER BY time DESC LIMIT 1"; }//定义常量$result = array(); $commentData = array();//读取产品的详细信息$productRes = mysql_query($sql, $connect);$productData = mysql_fetch_array($productRes, MYSQL_ASSOC); //产品详情和相应评论的结果集array_push($result, $productData, $commentData);//array_shift($result);echo json_encode($result);?>
Reply content:
This is the header information sent.
This is the response data
This is the data printed on the background page.
The last code to post in the background:
if($_POST['idp']){ //如果地址栏中有idp,则通过idp获取产品信息;否则根据当前时间获取(取最近有的数据) $idp = $_POST['idp']; $sql = "SELECT * FROM `product` WHERE id={$idp}";}else{ //如果没有idp ,则获取最近期的产品信息 $sql = "SELECT * FROM `product` ORDER BY time DESC LIMIT 1"; }//定义常量$result = array(); $commentData = array();//读取产品的详细信息$productRes = mysql_query($sql, $connect);$productData = mysql_fetch_array($productRes, MYSQL_ASSOC); //产品详情和相应评论的结果集array_push($result, $productData, $commentData);//array_shift($result);echo json_encode($result);?>
The JSON returned by accessing roamguid.sinaapp.com/page/detail/getdetail.php is GET
, executing the $sql = "SELECT * FROM
product ORDER BY time DESC LIMIT 1";
And you post
preach it idp
false
?