【发布时间】:2016-04-07 11:53:37
【问题描述】:
所以我为一个基本的 Mysql 数据库的 PHP 输出制作了一个测试脚本。问题是我想让称为 orderid 的自动增量能够成为一个链接,我可以单击该链接打开一个页面,该页面显示有关该订单的特定 ID 的更多信息。
似乎真的很难在网上找到任何东西,而且我已经看到了这样做的数据库。
另外(不在此脚本中)我使用了 CURRENT_TIMESTAMP,但它没有输入当前时间,而是使用当前日期。获取 MYSQL 或 PHP 的当前时间(AM PM 或 24 小时后转换)并输入的最佳方法是什么?
感谢您的帮助。
<?php
$con = mysqli_connect('localhost','user','password','database');
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
else{
$sql="SELECT * FROM custinfo WHERE orderopen = 1";
$result = mysqli_query($con,$sql);
echo "<table border='1' bordercolor='blue' bgcolor='CCFFFF' cellpadding='0'>
<tr><h2> Open Orders:</h2>
<th>OrderID</th>
<th>Firstname</th>
<th>Lastname</th>
<th>Phone</th>
</tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td><h3><font color='blue'>" . $row['orderid'] . "</font></h3></td>";
echo "<td><h3><font color='blue'>" . $row['firstname1st'] . "</font></h3></td>";
echo "<td><h3><font color='blue'>" . $row['lastname1st'] . "</font></h3></font></td>";
echo "<td><h3><font color='red'>" . $row['phone'] . "</font></h3></td>";
echo "</tr>";
}
echo "</table>";
}
mysqli_close($con);
?>
【问题讨论】:
标签: php mysql database datetime hyperlink