我最近更新了我工作的服务器。我有一个错误:
“警告:array_flip() 期望参数 1 为数组,在...中给出空值”
有人知道如何解决吗?
这是PHP代码的一部分:
function redirectWrongDep($url) {
$deps = @getDepsByIdUrl($url);
$depsFlip = array_flip($deps);
if ($_GET['dep'] && !in_array($_GET['dep'], $depsFlip)) { header('Location:'.URL);
exit();
}
}
function getDepsByIdUrl($url) {
$sql = "SELECT ws_flash_departement.nom,ws_flash_departement.id_departement FROM ws_flash_departement WHERE ws_flash_departement.no_resultats != 0 AND ws_flash_departement.id_departement IN (SELECT url_departement.id_departement FROM url_departement WHERE url_departement.id_url=" . $url . ") ORDER BY nom ASC";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
$deps[$row["id_departement"]]=utf8_encode($row["nom"]);
}
mysql_free_result($result);
return $deps;
}