所以这是我简单的PHP代码,只是在简单的表上输出它们。我希望我把它变成一个可排序的表,我不理解在线的大多数来源。有人能告诉我一个简单的或至少是这样的方式吗?我也可以去下拉菜单选择如何列出以下数据列!
$connect = mysql_connect("localhost","root","");
if(!$connect){
die("Can not connect: " . mysql_error());
}
mysql_select_db("safedrive", $connect);
$sql = "SELECT * FROM users";
$myData = mysql_query($sql,$connect);
echo "<table border=1>
<tr>
<th>ID</th>
<th>Email</th>
<th>First Name</th>
<th>Last Name</th>
<th>Model</th>
<th>Year</th>
<th>Plate Number</th>
<th>City</th>
<th>Country</th>
</tr>";
while($record = mysql_fetch_array($myData)){
echo "<tr>";
echo "<td>" . $record['id'] . "</td>";
echo "<td>" . $record['email'] . "</td>";
echo "<td>" . $record['firstName'] . "</td>";
echo "<td>" . $record['lastName'] . "</td>";
echo "<td>" . $record['model'] . "</td>";
echo "<td>" . $record['Year'] . "</td>";
echo "<td>" . $record['plateNumber'] . "</td>";
echo "<td>" . $record['city'] . "</td>";
echo "<td>" . $record['country'] . "</td>";
echo "<br />";
}
echo "</table>";
我知道在HTML标签中可能做得更好,但我想听听一些正确的意见。