我已经编写了这段代码,它运行得很好,但我需要如何在输出文件上创建链接(href)。我尝试了几种方法,但我就是做不到,不需要答案,但需要一些指导。
if ($row = mysqli_fetch_array($result)) {
$output = $row["id"];
}
if ($output) {
echo $output;
}
else {
echo "That is not a valid record on our database";
}
您应该只使用$output
回显锚点标签
$output = $row["title"];
$output ='FirstSong'; #To test i am using this as FirstSong
echo "<a href='songs?id=".$output."'>Click here</a>"; #You can have any text for href
所以你的代码将是
if ($row = mysqli_fetch_array($result)) {
$output = $row["title"];
}
if ($output) {
echo "<a href='songs?id=".$output."'>Click here</a>";
}
else { echo "That is not a valid record on our database"; }
这是的演示