简体   繁体   English

如何使查询结果中的字符串/变量成为php中的链接

[英]How to make string/variables from query results into a link in php

best regards. 最好的祝福。

I know perhaps some's considering my question is quite stupido. 我知道也许有人在考虑我的问题很愚蠢。 But I've been trying looking for to this simple scripting. 但是我一直在尝试寻找这种简单的脚本。 As my post title above, how to make the query results into a url. 就像我上面的帖子标题一样,如何使查询结果转换为网址。 I have this scripts: 我有这个脚本:

$result = mysqli_query($con,'SELECT......');

echo "<table border='1'>
<tr>
<th>Title</th>
<th>Author</th>
<th>Publisher</th>
<th>Category</th>
<th>Link</th>
</tr>";

    while($row = mysqli_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['title'] . "</td>";
  echo "<td>" . $row['author_name'] . "</td>";
  echo "<td>" . $row['publisher_name'] . "</td>";
  echo "<td>" . $row['cat_name'] . "</td>";
  echo "<td>" . $row['url_flipbook'] . "</td>";
  echo "</tr>";
  }
echo "</table>";

I want to make the result from $row ->'url_flipbook' into a url. 我想将结果从$ row->'url_flipbook'转换为url。 The $row -> 'url_flipbook' will produce a html pages that users can click on it, it's located to a folder in my localhost. $ row->'url_flipbook'将产生一个html页面,用户可以单击它,它位于我的本地主机的文件夹中。

The database field: 数据库字段:

| url_flipbook |
-----------------
/myspace/click-it/info_1.html

I want that query results became a link for the output. 我希望查询结果成为输出的链接。 I've tried: 我试过了:

<a href=''echo $row['url_flipbook'];'?>''>FLIPBOOK</a>"</td>";
echo "<td>" . <a href='$row['url_flipbook']>FLIPBOOK</a>"</td>"; 

Nothing works...if you could help me to solve this problems. 什么都行不通...如果您可以帮助我解决此问题。 Thank you so much... best regards, 非常感谢...最好的问候,

Kris 克里斯

Just concat the string to the href : 只需将字符串连接到href

echo "<td><a href=\"" . $row['url_flipbook'] . "\">FLIPBOOK</a></td>";

or alternatively: 或者:

echo '<td><a href="' . $row['url_flipbook'] . '">FLIPBOOK</a></td>';

你尝试过吗

echo "<td>" . "<a href='" . $row['url_flipbook'] . "' >FLIPBOOK</a></td>";

尝试这个

echo "<td><a href='".$row['url_flipbook']."'>FLIPBOOK</a></td> ";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM