求助~或许是小问题
PHP code1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http:
-->
$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<$rows=mysql_num_rows($result)){
$i++;
echo "<p>";
echo "<table border='0' width='300'>";
echo "<tr>";
echo "<td>";
echo "<a href=View.php?id=".$row["id"].">".$row["title"]."</a>";
echo "</td>";
echo "<td>";
echo "[".$row["author"]."]";
echo "</td>";
echo "<td>";
echo "[".$row["date"]."]";
echo "</td>";
echo "</tr>";
}
echo "</table>";
显示结果为:
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=mysql_fetch_array($result); // 删了 while($rows=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 "";
echo "";
echo "";
echo "";
echo "";
}
echo "
"; echo "".$row["title"]." "; echo " "; echo "[".$row["author"]."]"; echo " "; echo "[".$row["date"]."]"; echo "
";
武汉格发信息技术有限公司,格发许可优化管理系统可以帮你评估贵公司软件许可的真实需求,再低成本合规性管理软件许可,帮助贵司提高软件投资回报率,为软件采购、使用提供科学决策依据。支持的软件有: CAD,CAE,PDM,PLM,Catia,Ugnx, AutoCAD, Pro/E, Solidworks ,Hyperworks, Protel,CAXA,OpenWorks LandMark,MATLAB,Enovia,Winchill,TeamCenter,MathCAD,Ansys, Abaqus,ls-dyna, Fluent, MSC,Bentley,License,UG,ug,catia,Dassault Systèmes,AutoDesk,Altair,autocad,PTC,SolidWorks,Ansys,Siemens PLM Software,Paradigm,Mathworks,Borland,AVEVA,ESRI,hP,Solibri,Progman,Leica,Cadence,IBM,SIMULIA,Citrix,Sybase,Schlumberger,MSC Products...