<?php
/*
* Created on 2010-4-24
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
include("conn.php");?><?php
echo "<table width=500 border='0' align='center' cellpadding='5' cellspacing='1' bgcolor='#add3ef'>";
$strSQL='select * from message ';
$query=mysql_query($strSQL);
while($rowMsg=mysql_fetch_array($query))
echo "<tr bgcolor='#eff3ff'>";
echo "<td>标题:$rowMsg[title] 用户:$rowMsg[userName]</td>";
echo "</tr><td>内容:$rowMsg[content]</td> </tr> </table>";
?>
数据库连接没有问题,就是表格循环输出就数据出来啊???
各位大侠帮忙看下这段代码是否有错???
$strSQL='select * from message ';
$query=mysql_query($strSQL);
while($rowMsg=mysql_fetch_array($query))
{
echo "<tr bgcolor='#eff3ff'>";
echo "<td>标题:$rowMsg[title] 用户:$rowMsg[userName]</td>";
echo "</tr><td>内容:$rowMsg[content]</td> </tr> </table>";
}括号括起来就OK罗。
<?php
echo "<table width=500 border='0' align='center' cellpadding='5' cellspacing='1' bgcolor='#add3ef'>";
$strSQL='select * from message ';
$query=mysql_query($strSQL);
while($rowMsg=mysql_fetch_array($query)) {
echo "<tr bgcolor='#eff3ff'>";
echo "<td>标题:$rowMsg[title] 用户:$rowMsg[userName]</td>";
echo "</tr><td>内容:$rowMsg[content]</td> </tr>";
}
echo '</table>'; //这个不包括在循环内
?>
<?php
/*
* Created on 2010-4-22
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
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]."ttttt"?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?=$row[content]?></td>
</tr>
<?php
}
?>
</table>为什么easyEclipse无法解析<?=$row[content]?>
如果这样写:<?php echo $row[content]?>
就能出来,各位大侠帮忙看下是什么原因,怎么解决啊???