php提示错误:Parse error: syntax error, unexpected T_FOR, expecting ',' or ';' in E:\search.php

<?php

$item=$_POST['item'];
$content=$_POST['content'];

$content=trim($content);
if(!$item||!$content)
{
echo '请选择一个搜索项并填写要搜索的内容';
exit;
}
if(!get_magic_quotes_gpc())
{
$content=addslashes($content);
}

$db=@new mysqli("localhost","root","qihui668","test","3308");
if(mysqli_connect_error()){
echo "数据库连接失败!<br>\n";
echo mysqli_connect_error();
exit;
}

if($item==1)
$field='f_name';
if($item==2)
$field='f_email';
else{
echo '搜索项不被支持!';
exit;
}
$sql="select * from t_employee where $field like '%$content%'";
$rs = $db->query($sql);

$rsNum = $rs->num_rows;
echo "<p>本次搜索共找到<b> $rsNum </b>条记录。</p>"
for ($i = 0; $i < $rsNum; $i++){ /////////////////////////////////////此处出错了
$row= $rs->fetch_assoc();
echo '----------------------------------------------<br/>';
echo '<b> 姓名: </b>'.htmlspecialchars(stripslashes($row['f_name'])).'<br/>';
echo '<b> 性别: </b>'.($row['f_gender']!=0?'男':'女').'<br/>';
$education_str='';
switch($row['f_education']){
case 1:
$education_str='博士';break;
case 2:
$education_str='硕士';break;
case 3:
$education_str='本科';break;
case 4:
$education_str='大专';break;
case 5:
$education_str='其他';break;
}
echo '<b> 学历: </b>'.$education_str.'<br>';
list($year,$month,$day,$hour,$min,$sec)=split('[:-]',$row['f_borntime']);
echo '<b> 出生日期: </b>'."{$year}-{$month}-{$day}".'<br/>';
echo '<b> email: </b>'.htmlspecialchars(stripslashes($row['f_email'])).'<br/>';
echo '<b> 电话: </b>'.htmlspecialchars(stripslashes($row['f_phone'])).'<br/>';
echo '----------------------------------------------<br/><br/>';
}
$rs->free();
$db->close();
?>

问题很明显啊,你要好好看错误提示呀。
echo "<p>本次搜索共找到<b> $rsNum </b>条记录。</p>"
后面少了个结束标记 ,加个分号就好了啊。

expecting ',' or ';' => 这都提示你了呀。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-06-11
echo "<p>本次搜索共找到<b> $rsNum </b>条记录。</p>"
for ($i = 0; $i < $rsNum; $i++){ /////////////////////////////////////此处出错了
看上一行,没有以分号结束呀
第2个回答  2011-06-11
你找到提示错误的行。少写了个分好结束。,或是单双引号的问题、

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网