帮我看看一下的程序错在哪里,谢谢!

marlantz 2002-07-30 05:43:53
<html>
<head>
<title>在线投票!</title>
</head>
<body bgcolor="#0099FF" text="#666666">
<div align="center">
<form action="12.php" method="get" name="form">
<table width="75%" border="0" cellspacing="1" bgcolor="#FFFF00">
<tr bgcolor="#0099FF" align="center" valign="middle">
<td width="20%" height="30">添加投票项目</td>
<td width="65%" height="30">
<input type="text" name="item0" size="50%">
</td>
<td width="15%" height="30">
<input type="submit" name="Submit" value="添加">
</td>
</tr>
</table>
</form>
<br>
<table width="75%" border="0" cellspacing="1" bgcolor="#FFFF00" cellpadding="1">
<tr bgcolor="#0099FF" valign="bottom">
<td align="center" height="17"> 调查项目 </td>
<td align="center" height="17">开始时间 </td>
<td align="center" height="17"> 投票 </td>
</tr>
<?
$connect=mysql_connect('localhost','12','************'); //连接数据库
$select=mysql_select_db('name',$connect); //选择数据库
$query=mysql_query('select * from vote',$connect); //取出数据库
while ($array=mysql_fetch_array($query))
{printf("<tr bgcolor="#0099FF" valign="bottom"><td align="center" height="17">%s</td><td align="center" height="17">%s</td><td align="center" height="17">%s</td></tr>",$array[item],$array[time],$array[ballot]);}
?>
</table>
</div>
</body>
</html>
运行是程序提示我“Parse error: parse error in C:\apache\htdocs\try\ivote\7.php on line 34
”就是“</table>”请问该怎么改?
...全文
32 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
LeeMaRS 2002-07-30
  • 打赏
  • 举报
回复
print是使用格式化串表示输出格式,echo是直接输出.
具体可以看PHP的手册:)
xizi2002 2002-07-30
  • 打赏
  • 举报
回复
to LeeMaRS(小菜虎_水壶的仇人):
能不能具体说一下:print和echo的区别
LeeMaRS 2002-07-30
  • 打赏
  • 举报
回复
printf是从C中引入的格式化输出,挺好用的,比echo功能强些.
LeeMaRS 2002-07-30
  • 打赏
  • 举报
回复
是printf的问题.改成这样:

printf("<tr bgcolor='#0099FF' valign='bottom'><td align='center' height='17'>%s</td><td align='center' height='17'>%s</td><td align='center' height='17'>%s</td></tr>",$array[item],$array[time],$array[ballot]);
eagle_gui 2002-07-30
  • 打赏
  • 举报
回复
printf("<tr bgcolor="#0099FF"

????

我怎么没见过有这种输出格式?看来我很落后

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧