douzhun4124 2012-12-06 23:37
浏览 30
已采纳

如何在数据库中显示每列的前两个记录?

Here is the PHP I'm using.

echo "<td class='leftalign'>";
echo "<tr id='centered' >" . $row['Fund_Yield'] . "</td></tr>";
echo "<tr id='centered' >" . $row['Fund_Benchmark_Yield'] . "</tr>";
echo "<tr id='centered' >" . $row['Class_Yield'] . "</tr>";
echo "<tr id='centered' >" . $row['Special_Class_Yield'] . "</tr>";
echo "<tr id='centered' >" . $row['Plus_minus_Benchmark'] . "</tr>";
echo "<tr id='centered' >" . $row['Plus_Minus_Class'] . "</tr>";
echo "<tr id='centered' >" . $row['Plus_Minus_Special_Class'] . "</tr>";
echo "<tr id='centered' >" . $row['Percentile_Class'] . "</tr>";
echo "<tr id='centered' >" . $row['Percentile_Special_Class'] . "</tr>";

echo"</td>";

Each label contain 4 records but I only want to display the first two or whatever I specify.

  • 写回答

1条回答 默认 最新

  • duangan6731 2012-12-06 23:40
    关注

    you would use LIMIT in your query http://php.about.com/od/mysqlcommands/g/Limit_sql.htm

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥20 求用stm32f103c6t6在lcd1206上显示Door is open和password:
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法