gpt4 book ai didi

php - 如何在PHP中显示表格中的数据

转载 作者:行者123 更新时间:2023-11-29 08:10:07 24 4
gpt4 key购买 nike

我在 PHP 中显示表格时遇到问题。我已经安装了短代码 exec php 插件。

这是我完成的代码:

if(mysql_num_rows($raw_results) > 0){ 

while($results = mysql_fetch_array($raw_results)){

echo "<p><h3>".$results['id']."</h3>"."Student Name :".$results['name']." </p>" . "</br>";
echo "Age : ".$results['age']." Years old.</br>";
echo "Course : ".$results['course']."</br>";
echo "Gender : ".$results['gender']."</br></br>";
echo "<HR>";

}
}

我可以知道如何对表格中的数据进行排序吗?我尝试的任何表格代码似乎根本不显示..

最佳答案

<table>
<tr>
<td>Student name</td>
<td>Age</td>
<td>Course</td>
<td>Gender</td>
</tr>
<?php
if(mysql_num_rows($raw_results) > 0){
while($results = mysql_fetch_array($raw_results)){
echo "<tr><td>".$results['id']."</td>";
echo "<td>".$results['age']."</td>";
echo "<td>".$results['course']."</td>";
echo "<td>".$results['gender']."</td></tr>";
}
}
?>
</table>

php中的数组排序 http://us1.php.net/manual/en/function.sort.php

关于php - 如何在PHP中显示表格中的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21772119/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com