我有一个页面,我将来自mysql的数据调用到一个表中。我正在尝试创建一种情况,他们可以点击桌面上的日期,并将它们链接到另一个页面。这是我正在处理的代码
$q = "SELECT*FROM forum";
$r = mysqli_query($dbc,$q);
if (mysqli_num_rows($r)>0)
{
echo'<table><tr><th>Posted By</th>
<th>Subject</th><th id="msg">Message</th></tr>';
while ($row=mysqli_fetch_array($r,MYSQLI_ASSOC))
{
echo'<tr>
<td>'.$row['first_name'].''.$row['last_name'].'<br>
'.$row['post_date'].'</td>
<td>'.$row['subject'].'</td><td>'.$row['message'].'</td>
</tr>';
}
echo '</table>';
}
else
{echo '<p>There are currently no messages.</p>';}
我正在尝试将锚标签放在此代码上
'.$row['post_date'].'
我试过这个
<a href="edit.php">'.$row['post_date'].'</a>
但它无效
答案 0 :(得分:2)
试试这个:
<a href="edit.php"><?= $row['post_date']; ?></a>
或更短的变体:
SELECT
ID,
CASE WHEN ID = 1 Then 'Open'
WHEN Id = 2 then 'Close'
When ID = 3 then 'Transfer'
else '' END AS ActionType,Sum(Quantity) as Quantity,sum(Fee)
FROM Table_Name
Group by
ID,
CASE WHEN ID = 1 Then 'Open'
WHEN Id = 2 then 'Close'
When ID = 3 then 'Transfer'
else '' END