我需要為數組中的每個值執行數據庫選擇功能。參數theRequestApplicationName包含一個數組,如["fb","dropbox","twitter"]我需要選擇功能,在下面提到的查詢中,它應該類似于 application.name = 數組的每個值。請幫我解決這個問題ApplicationLogoutUrl = function (theRequestId, theRequestApplicationName, theRequestOrg, connection, res){ theQuery = "select org_uses_app.app_logout_url from application, org_uses_app where application.id=org_uses_app.application and application.name = --";}
3 回答

UYOU
TA貢獻1878條經驗 獲得超4個贊
你的 sql 查詢應該是這樣的 -
//$array variable is your array name like below
// $array = ["fb","dropbox","twitter"];
theQuery = "select org_uses_app.app_logout_url from application, org_uses_app
where application.id=org_uses_app.application and application.name IN
('$array[0]','$array[1]','$array[2]')";

繁星淼淼
TA貢獻1775條經驗 獲得超11個贊
查詢的基本結構可以是
SELECT item FROM database.table WHERE firstCondition OR secondCondition
假設數據庫被命名applications,具有apps以下屬性的表id和name一條記錄{id: 'fb', name: 'facebook'},php中的查詢將是
SELECT app_logout_url
FROM applications.apps
WHERE id = fb OR name = facebook;
- 3 回答
- 0 關注
- 133 瀏覽
添加回答
舉報
0/150
提交
取消