1
所以,我寫了一些查詢代碼返回true,則返回錯誤:mysqli_multi_query() - 而不是返回數據
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given
我明白,這是導致從查詢一個布爾反應,我已經檢查它出來了,返回的布爾值等於true。所以,我不明白爲什麼有一個數據陣列,而不是沒有任何反應......這是我的代碼:
$data = mysqli_multi_query($connection, 'UPDATE teams SET teams.teamViews = teams.TeamViews
+ 1 WHERE (teams.teamID, \''.$userToken.'\') NOT IN (SELECT teams_views.teamId,
teams_views.'.$viewType.' FROM teams_views) AND teams.teamUrl = \''.TEAM_URL.'\';
INSERT INTO teams_views (teamId, '.$viewType.') SELECT t.teamId, \''.$userToken.'\'
FROM teams t WHERE t.teamUrl = \''.TEAM_URL.'\' AND NOT EXISTS (SELECT \''.$userToken.'\'
FROM teams_views WHERE t.teamId = teamId);
SELECT * FROM teams WHERE teams.teamUrl = \''.TEAM_URL.'\';');
$dataRow = mysqli_fetch_array($data, MYSQLI_ASSOC);
有三種查詢的SQL - 更新,插入和選擇。
我該如何改變我的查詢或PHP返回數據,而不是布爾值?謝謝
一個電話到**'mysqli_store_result' **,**'mysqli_free_result' **組合,和**'mysqli_next_result' **。 – spencer7593