关于数据库返回数据的问题
时间:2010-01-09
来源:互联网
<?php
include("1.php");
?>
<table width="669" height="165" border="1">
<?
$sql="select * from message order by desc" or die(mysql_error());
$query=mysql_query($sql);
while($row=mysql_fetch_array($query)){
?>
<tr>
<th scope="col">标题:<?=$row[title]?></th>
<th scope="col"><p> </p> </th>
</tr>
<tr>
<th scope="row">用户:<?=$row[user]?></th>
<td><div align="center">内容:
<?=$row[content]?>
</div></td>
</tr>
<?
};
?>
</table>
'700')this.width='700';if(this.offsetHeight>'700')this.height='700';" title="Click Here To EnLarge">
作者: shi183 发布时间: 2010-01-09
所有的$row[xxxxx]都换成$row['xxx'] - 加了引号
所有的<?=$row[xxx]?>都换成<?php echo $row['xxx']; ?>
作者: cain 发布时间: 2010-01-09
作者: tafengnanhai 发布时间: 2010-01-10
<?php
include("1.php");
?>
<table width="669" height="165" border="1">
<?
$sql="select * from message order by id desc" or die(mysql_error());
$query=mysql_query($sql);
while( $row=mysql_fetch_array($query)){
?>
<tr>
<th scope="col">标题:<?php echo $row['title']?></th>
<th scope="col"><p> </p> </th>
</tr>
<tr>
<th scope="row">用户:<?php echo $row['user']?></th>
<td><div align="center">内容:
<?php echo $row['content']?>
</div></td>
</tr>
<?
}
?>
</table>
作者: shi183 发布时间: 2010-01-10
在看不明白你就没救了。转行吧。
作者: cain 发布时间: 2010-01-10
<?php
$sql="select * from message order by id desc" or die(mysql_error());
$query=mysql_query($sql);
while( $row=mysql_fetch_array($query)){
?>
<tr>
<th scope="col">标题:<?php echo $row['title']?></th>
<th scope="col"><p> </p> </th>
</tr>
<tr>
<th scope="row">用户:<?php echo $row['user']?></th>
<td><div align="center">内容:
<?php echo $row['content']?>
</div></td>
</tr>
<?php
}
?>
</table>
这个就好了!!没什么错误,你的就是用<??>有问题。
把你的程序都写成<?php ?>,应该就没有错误了!!
作者: jsny821 发布时间: 2010-01-10
原因我已经找到就是在我原来的<??>要变成<?php?>
其实我是按的教程写的,他可以执行,我却要加点东西,郁闷,可能是版本的问题吧
不过非常感谢各位的帮助,谢谢!!
<?php
include("1.php");
?>
<table width="669" height="165" border="1">
<?php
$sql="select * from message order by id desc" or die(mysql_error());
$query=mysql_query($sql);
while( $row=mysql_fetch_array($query)){
?>
<tr>
<th scope="col">标题:<?php echo $row['title']?></th>
<th scope="col"><p> </p> </th>
</tr>
<tr>
<th scope="row">用户:<?php echo $row['user']?></th>
<td><div align="center">内容:
<?php echo $row['content']?>
</div></td>
</tr>
<?php
}
?>
</table>
作者: shi183 发布时间: 2010-01-10
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28