大家好,我是新来的,我很难分析这段代码。错误不断出现,我不知道该怎么办。
mysql_fetch_array() 期望参数 1 是资源,给定的布尔值
每次我使用搜索时都会发生这种情况。有任何想法吗?
if(isset($_POST['search']))//if search
{
if(($_POST['year']) && ($_POST['month']) && ($_POST['day']))
$_SESSION['select']= mysql_query("SELECT * FROM ".$_SESSION['dbtable3']." WHERE eyear = '".$_POST['year']."' AND emonth = '".$_POST['month']."' AND edate = '".$_POST['day']."' ;" or die(mysql_error()));
else if(($_POST['year']) && ($_POST['month']))
$_SESSION['select']=mysql_query("SELECT * FROM ".$_SESSION['dbtable3']." WHERE eyear = '".$_POST['year']."' AND emonth = '".$_POST['month']."' ;" or die(mysql_error()));
else if(isset($_POST['year']))
$_SESSION['select']= mysql_query("SELECT * FROM ".$_SESSION['dbtable3']." WHERE eyear = '".$_POST['year']."' ;" or die(mysql_error()));
else if(!$_POST['year'])
die("FILL IN AT LEAST THE YEAR");
else
die("Date not found");
if($_POST['year'])
while($select2 = mysql_fetch_array($_SESSION['select']))
{
$n1 = $select2[0];
$n2 = $select2[1];
$n3 = $select2[2]."-".$select2[3]."-".$select2[4];
echo
"<tr>
<td width=\"30px\"> $n1</td>
<td width=\"30px\"> $n2</td>
<td width=\"30px\"> $n3</td>
</tr>";
}