跟着视频教程打的,但教程弄出来的是对的,我弄出来就是错的<?php
include("conn.php");?>
<table width=500 border="0"align="center"cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?php
$sql="select*from message";
$query=mysql_query($sql);while($row=mysql_fetch_array($query)){
?>
<tr bgcolor="#eff3ff">
<td>标题:<?=$row[title]?> 用户:<?=$row[user]?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?=$row[content]?></td>
</tr>
<?
}
?>
</table>
Parse error: syntax error, unexpected $end in D:\wamp\www\bbs2\list.php on line 29
include("conn.php");?>
<table width=500 border="0"align="center"cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?php
$sql="select*from message";
$query=mysql_query($sql);while($row=mysql_fetch_array($query)){
?>
<tr bgcolor="#eff3ff">
<td>标题:<?=$row[title]?> 用户:<?=$row[user]?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?=$row[content]?></td>
</tr>
<?
}
?>
</table>
Parse error: syntax error, unexpected $end in D:\wamp\www\bbs2\list.php on line 29
<?php
include("conn.php");Echo '<table width=500 border="0"align="center"cellpadding="5" cellspacing="1" bgcolor="#add3ef">';
$sql="select * from message";
$query=mysql_query($sql);while($row=mysql_fetch_array($query)){
Echo '<tr bgcolor="#eff3ff">';
Echo '<td>标题:',$row[title],' 用户:',$row[user],'</td>';
Echo '</tr><tr bgColor="#ffffff">';
Echo '<td>内容:',$row[content],'</td></tr>';
}Echo '</table>';?>
这种形式是老的规范,新规范:
<?PHP echo $row[title] ; ?>
$row[user]
$row[content]要改成:
$row['title']
$row['user']
$row['content']
加上引号:$row['content']
<?php
include("conn.php");?>
<table width=500 border="0"align="center"cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?php
$sql="select*from message";
$query=mysql_query($sql);while($row=mysql_fetch_array($query)){
?>
<tr bgcolor="#eff3ff">
<td>标题:<?php echo $row[title]?> 用户:<?php echo $row[user]?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?php echo $row[content]?></td>
</tr>
<?php
}
?>
</table>
即可,你遇到的问题是因为短标签的问题,不建议使用<??>这种方式,应该使用<?php ?>这种风格