Rcode_OK, 'data' => "", 'msg' => 'ok' ); set_time_limit(50); $conn = createConn(); $sql = ""; $stmt = null; //echo "fuck php not conn ?"; if ($type == "all") { // 无条件全选 if (!empty($key)) { // echo " \n php is low \n"; $sql = "SELECT count(*) as total FROM mysql85931094_db.hfy_product as p where p.name like '".$key."'"; $stmt = mysqli_prepare($conn, $sql); mysqli_stmt_bind_param($stmt, "s", $key); } else { // echo " \n fuck php \n"; $sql = 'SELECT count(*) as total FROM mysql85931094_db.hfy_product as p '; $stmt = mysqli_prepare($conn, $sql); // mysqli_stmt_bind_param($stmt, ""); } } else { if (!empty($key)) { // echo " \n fuck php ? \n"; $sql = 'SELECT count(*) as total FROM mysql85931094_db.hfy_product as p , mysql85931094_db.hfy_product_type as p_type where p.type_id = p_type.type_id and p_type.type_key = ? and p.name like \''.$key.'\' ;'; $stmt = mysqli_prepare($conn, $sql); mysqli_stmt_bind_param($stmt, "s", $type); } else { // echo " \n fuck fuck fuck \n"; $sql = 'SELECT count(*) as total FROM mysql85931094_db.hfy_product as p , mysql85931094_db.hfy_product_type as p_type where p.type_id = p_type.type_id and p_type.type_key = ? ;'; $stmt = mysqli_prepare($conn, $sql); mysqli_stmt_bind_param($stmt, "s", $type); } } mysqli_stmt_execute($stmt); // echo " fuck_2"; $res = mysqli_stmt_get_result($stmt); // mysqli_stmt_get_result // $rs = mysqli_fetch_assoc($res); // 获取行数据 // $result = mysqli_stmt_get_result($stmt); // $row = mysqli_fetch_array($result, MYSQLI_NUM); // 获取行数 // $count = $row[0]; $row = mysqli_fetch_array($res, MYSQLI_NUM); mysqli_close($conn); $resObj['data'] = array( 'count' => $row[0], 'limit' => $limit ); // echo "fuck ".$res; echo json_encode($resObj); }catch(Exception $e) { echo 'server Error Message: notFound'; }