0
Postman is an IDE for making APIs in Chrome.傳遞CSV到PHP編碼的多個行中JSON
我已路由定義爲:
隨着在PHP case語句邏輯爲:
case "checkContactsWithServer":
if ($userId = authenticateUser($db, $username, $password, $gcmregid))
{
$phoneNumCSV = $_REQUEST['phone_num_csv'];
$syncContactsServerSQL = "SELECT DISTINCT
source_user_sync_id, target_user_sync_id, friend_request_sync_id, status, user_sync_id, phone_number
FROM friends a
RIGHT JOIN (SELECT distinct
user_sync_id,
phone_number
FROM users
WHERE phone_number IN ('".$phoneNumCSV."')
AND user_sync_id != '".$userId."'
) b
ON a.target_user_sync_id = '".$userId."'
AND a.source_user_sync_id = b.user_sync_id
OR a.source_user_sync_id = '".$userId."'
AND a.target_user_sync_id = b.user_sync_id;";
if($result = $db->query($syncContactsServerSQL))
{
$rows = array();
while($row = $result->fetch_assoc()){
$rows[] = array('data' => $row);
}
// now all the rows have been fetched, it can be encoded
echo json_encode($rows);
}
else
{
$out = FAILED;
}
}
else
{
error_log($out, 0);
$out = FAILED;
}
break;
從上面可以看出,將兩個電話號碼作爲CSV傳遞,即。 「number1,number2」,JSON結果只有一個對象。但運行在數據庫中查詢,返回兩個,因爲它應該:
我知道我失去了一些東西簡單在這裏。我怎樣才能配置這個工作?
我不得不扭轉圖片搜索你的截圖只是爲了弄清楚這是所謂的「郵遞員」。你的整個問題你都沒有提過你要求幫助的軟件名稱。祝你好運.. –
使用郵遞員只是允許發送有組織的請求到您的服務器進行測試,沒有什麼特別的 – Sauron
好吧然後,如何回合標記SQL ..似乎是一個SQL問題對我 –