如何使表字段作为链接返回(通过简单的 echo 命令)
我花了几个小时试图弄清楚如何通过 PHP echo()
将链接放入以下文本输出中。我基本上想让我从事件表中提取的标题字段(如下面代码中的 #4 所示)以链接形式返回到浏览器,而不仅仅是文本...
带回的原始代码事件标题:
<?php
// 3. Perform database Query to bring list of events
$result = mysql_query("SELECT * FROM events", $connection);
if (!$result) {
die("Database query failed: " . mysql_error());
}
// 4. Use returned Data
while ($row = mysql_fetch_array($result)) {
echo $row ["eventtitle"]."<br/>".$row["eventdesc"]."<br/>";
}
?>
如何让 $row["eventtitle"]
以链接形式显示在浏览器中?假设链接只是“eventprofile.php”。这可能是一个简单的修复,但我在使用 尝试不同的事情时遇到了一百万个错误。
I've been trying for hours to figure out how to put a link into the following text output via PHP echo()
. I basically want to make the title field I'm pulling from my events table (as seen in #4 in the code below) to come back into the browser as a link instead of just text...
the original code that brings back the event title:
<?php
// 3. Perform database Query to bring list of events
$result = mysql_query("SELECT * FROM events", $connection);
if (!$result) {
die("Database query failed: " . mysql_error());
}
// 4. Use returned Data
while ($row = mysql_fetch_array($result)) {
echo $row ["eventtitle"]."<br/>".$row["eventdesc"]."<br/>";
}
?>
How would I go about getting that $row["eventtitle"]
to appear in the browser as a link? Let's say if the link was just "eventprofile.php". This is probably an easy fix, but I've been getting a million errors with trying different things with <a href>
s.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为其添加一个锚标签!!
就是这样。
add an anchor tag for it!!
And thats it.