我正在尝试做这样的事情:
<?php while($row = mysqli_fetch_assoc($result)) { ?>
<li><?php echo $row["msg"] ;?>(id: <?php echo $row["msg_id"] ;?>) | sent at <?php echo $row["data"] ;?> <a href="message.php">see</a> | <a href="delete.php?msg_id=<?php $row["msg_id"]?>">delete</a></li>
<?php
}
?>
但它不起作用。 msg_id 是正确的,数据库信息也很好,但我不知道如何制作像 delete.php?msg_id= $ROW_MSG_ID
这样的网址。
也许你可以帮助我。谢谢!
最佳答案
<?php
/* This code is a little bit hard to read.
It would be much easier to troubleshoot if it is cleaner.
Besides that, the problem could be your message.php or delete.php.
This code is actually fine by itself. */?>
<li>
<?php
echo $row['msg'].'(id: '.$row['msg_id'].') | sent at '.$row['data'];
echo '<a href="message.php">see</a> | '.
'<a href="delete.php?msg_id='.$row['msg_id'].'">delete</a>';
?>
</li>
<?php
/* Output:
* message(id: message_id) | sent at row_data see | delete.
// [link]see[/link to message.php] | [link]delete[/link to delete.php]
*/?>
关于php - 带变量的 Html <A> 链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50518156/