我研究這個沒有用,我想我會在這裏查詢自組的鄉親在SO似乎真靈通。檢查的MySQL結果
這裏的情況。我有一個數據庫,其中存儲了匹配項,用於爲我正在開發的聯盟應用創建結果/計劃。一切都很好,除了我上次的錯誤檢查。基本上我想要做的是檢查表格中選中的球隊在進行時間表時選擇的日期還沒有進行比賽。即TEAM1和TEAM2在2011年4月20日進行比賽(這已經在數據庫中),並且當聯盟管理員正在制定一個時間表時,我想確保這兩個隊伍都不能安排在該日再次參加比賽。
下面是到目前爲止我已經得到的代碼:
//check to make sure none of the teams are already scheduled to play on the same date
$resultarray = "";
$querydate = $_POST['date'];
$queryseason = $_SESSION['SEASON_ID'];
$sql2="SELECT MATCH_TEAM1_ID, MATCH_TEAM2_ID FROM MATCHES WHERE SEASON_ID ='$queryseason' AND MATCH_DATE='$querydate'";
$result2=mysql_query($sql2) or die(mysql_error());
$teamdateerror = false;
$resultSet = array();
while($resultarray = mysql_fetch_array($result2)){
$resultSet[] = $resultarray;
}
$commonteamcheck = array_intersect($resultset,$allteams);
vardump($commonteamcheck);
if ($commonteamcheck != ""){
$teamdateerror = true;
}
上面總是導致一個錯誤:警告:array_intersect()[function.array相交]:參數#1不是一個數組
有沒有想法?預先感謝任何幫助!
杜......也錯過了vardump。謝謝! – Rico 2011-04-20 17:54:22