您的位置:首页 > 其它

执行显示客户下拉列表时出现:syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

2012-02-24 09:44 676 查看
$result=mysql_query($sql,$conn);

while($row=mysql_fetch_array($result))
{
echo '<option>'.$row['department'].'</option>';//输出部门名

}

原来它是在HTML里写的,正确写法

<td><select name='Depart'>
<option>所有部门</option>";
$conn=mysql_connect('localhost','root','%$!**') or die('连接失败'); //连接服务器
mysql_select_db('lnwatchpc',$conn) or die('连接数据库失败'); //选择数据库
mysql_query('SET NAMES utf8'); //设置字符集
$sql='select department from depart';
$result=mysql_query($sql,$conn);
while($row=mysql_fetch_array($result))
{
echo '<option>'.$row['department'].'</option>';//输出部门名

}
echo "
</select></td>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐