如何在锚定标记中调用php变量
我有一个页面,在那里我将mysql中的数据调用到一个表中。我试图创造一种情况,让他们可以点击表格上的日期,并将他们链接到另一个页面。这是我正在编写的代码如何在锚定标记中调用php变量,php,html,mysql,Php,Html,Mysql,我有一个页面,在那里我将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<
$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>';}
我试过这个
<a href="edit.php">'.$row['post_date'].'</a>
但它不起作用试试这个:
<a href="edit.php"><?php echo $row['post_date']; ?></a>
或较短的变体:
<a href="edit.php"><?= $row['post_date']; ?></a>
回答得好。别忘了分号,谢谢。但我试过你的代码,但不起作用。你能检查一下我哪里做错了吗?。$row['first\u name'.]。$row['last\u name'.]。
“…”
@MichaelVillajin echo“$行['first_name']$行['last_name']。'';
<a href="edit.php"><?= $row['post_date']; ?></a>