How to mak a .$res['web']. a hyperlink

I am trying to make this mysql fetch field a hyper link

echo “

”.$res[‘web’]."";

hyper links are <a href="URL">label</a>

i may not have been clear on my post
i am retrieving data from mysql and it is being pulled into a table. the entry i need changed to hyperlink is
echo “

”.$res[web]. "
the [web] is the url that is pulled from the database

its not showing my td fields when i post

What is not showing?

  • The link? You didn’t use <a href="">
  • The value? Have a look at it with var_dump(), look in the webdevelopers console if there’s any characters the browser may render away

I have tried putting . It will not pull back anything for the db field. Below is the part of the code

<?php //while($res = mysql_fetch_array($result)) { // mysql_fetch_array is deprecated, we need to use mysqli_fetch_array while($res = mysqli_fetch_array($result)) { echo ""; echo "".$res['id'].""; echo "".$res['server'].""; echo "".$res['app'].""; echo "".$res['user'].""; echo "".$res['pass'].""; echo """"; echo "".$res['ip']."";

Then you did not select it.

I figured out the issue

echo “

”.$res[‘web’]."";
Thank for all of the suggestions.
<?php
        //while($res = mysql_fetch_array($result)) { // mysql_fetch_array is deprecated, we need to use mysqli_fetch_array
        while($res = mysqli_fetch_array($result)) {
            echo "<tr>";
            echo "<td>".$res['id']."</td>";
            echo "<td>".$res['server']."</td>";
            echo "<td>".$res['app']."</td>";
            echo "<td>".$res['user']."</td>";
            echo "<td>".$res['pass']."</td>";
            echo "<td><a href=" .$res['web']." target='_blank'>".$res['web']."</a></td>";
            echo "<td>".$res['ip']."</td>";

That makes no sense to do.

echo $res['web'];

Why are you adding quotes needlessly?

echo "<td><a href='{$res['web']}' target='_blank'>{$res['web']}</a></td>";
Sponsor our Newsletter | Privacy Policy | Terms of Service