+ -
当前位置:首页 → 问答吧 → 关于数据库返回数据的问题

关于数据库返回数据的问题

时间: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>

[ 此帖被shi183在2010-01-15 18:31重新编辑 ]
图片:1.png
'700')this.width='700';if(this.offsetHeight>'700')this.height='700';" title="Click Here To EnLarge">

作者: shi183   发布时间: 2010-01-09

e..又一个相同的问题

所有的$row[xxxxx]都换成$row['xxx'] - 加了引号
所有的<?=$row[xxx]?>都换成<?php echo $row['xxx']; ?>

作者: cain   发布时间: 2010-01-09

select * from message order by desc         order by  字段名 desc

作者: 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

所有的<?=$row[xxx]?>都换成<?php echo $row['xxx']; ?>
在看不明白你就没救了。转行吧。

作者: cain   发布时间: 2010-01-10

<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>
这个就好了!!没什么错误,你的就是用<??>有问题。
把你的程序都写成<?php  ?>,应该就没有错误了!!

作者: jsny821   发布时间: 2010-01-10

4楼的大哥,我已经按你说的做了,可是不行
原因我已经找到就是在我原来的<??>要变成<?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