~或许是小疑点
程序员文章站
2022-05-27 21:38:02
...
求助~或许是小问题
显示结果为:
test4 [aa] [2012-02-24 15:36:00]
test4 [aa] [2012-02-24 15:36:00]
test4 [aa] [2012-02-24 15:36:00]
test4 [aa] [2012-02-24 15:36:00]
重复的次数为我数据库里存储的数据数目,怎么才能让它从第一条显示呢?
比如:
test1 [aa] [2012-02-24 15:36:00]
test2 [aa] [2012-02-24 15:36:00]
test3 [aa] [2012-02-24 15:36:00]
test4 [aa] [2012-02-24 15:36:00]
又来麻烦各位了,谢谢~^^
------解决方案--------------------
更正一下是row
while($row=mysql_fetch_array($result)){
------解决方案--------------------
你的$row就没变过,肯定是一样的数据
------解决方案--------------------
$query="SELECT * from news ORDER by id desc Limit $offset,$page_size";
$result=mysql_query($query,$conn);
//$row=mysql_fetch_array($result); 这行放到while条件
不需要这个$i
//while($i//$i++;
while($row=mysql_fetch_array($result)){
echo "";
";
- PHP code
$query="SELECT * from news ORDER by id desc Limit $offset,$page_size";$result=mysql_query($query,$conn);$row=mysql_fetch_array($result);$i=0;while($i"; echo "
"; echo "".$row["title"].""; echo " | "; echo ""; echo "[".$row["author"]."]"; echo " | "; echo ""; echo "[".$row["date"]."]"; echo " | "; echo "
显示结果为:
test4 [aa] [2012-02-24 15:36:00]
test4 [aa] [2012-02-24 15:36:00]
test4 [aa] [2012-02-24 15:36:00]
test4 [aa] [2012-02-24 15:36:00]
重复的次数为我数据库里存储的数据数目,怎么才能让它从第一条显示呢?
比如:
test1 [aa] [2012-02-24 15:36:00]
test2 [aa] [2012-02-24 15:36:00]
test3 [aa] [2012-02-24 15:36:00]
test4 [aa] [2012-02-24 15:36:00]
又来麻烦各位了,谢谢~^^
------解决方案--------------------
更正一下是row
while($row=mysql_fetch_array($result)){
------解决方案--------------------
你的$row就没变过,肯定是一样的数据
------解决方案--------------------
$query="SELECT * from news ORDER by id desc Limit $offset,$page_size";
$result=mysql_query($query,$conn);
//$row=mysql_fetch_array($result); 这行放到while条件
不需要这个$i
//while($i//$i++;
while($row=mysql_fetch_array($result)){
echo "
";
echo "
"; echo "".$row["title"].""; echo " | ";"; echo "[".$row["author"]."]"; echo " | ";"; echo "[".$row["date"]."]"; echo " | ";
相关文章
相关视频