PHP 不能显示数据

来源:百度知道 编辑:UC知道 时间:2024/05/10 14:18:17
<?php
/*
* PHP100Job v1.0
* Programmer : Msn/QQ haowubai@hotmail.com (925939)
* www.php100.com Develop a project PHP - MySQL - Apache
* Window 2003 - Preferences - PHPeclipse - PHP - Code Templates
*/
include("conn.php");

include("head.php");
$SQL="SELECT * FROM `message` order by id desc";
$query=mysql_query($SQL);
while($row=mysql_fetch_array($query)){
?>

<table width=500 border="0" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<tr bgcolor="#eff3ff">
<td>标题:<?=$row[title]?> 用户:<?=$row[user] ?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?=$row[content]?></td>
</tr>
</table>
<?php
}

如果SQL语句没问题那么就应该改下面的代码了
<td>标题:<?php echo$row[title]; ?> 用户:<?php echo$row[user]; ?></td> <td>内容:<?php echo$row[content];?></td>
应该改为 :<td>标题:<?php echo "$row[title]"; ?> 用户:<?php echo "$row[user];" ?></td> <td>内容:<?php echo "$row[content];"?></td>

<?=$row[title]?> 应该写成<?=$row[title];?>
少分号了

那就是echo 和“=”号的区别了

输出要用echo $row['title'];或print $row['title'];

php.ini 设置有问题