简体   繁体   中英

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. The $row -> 'url_flipbook' will produce a html pages that users can click on it, it's located to a folder in my localhost.

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 :

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> ";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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