-1

This is the PHP script and I can load my data in database but elements in the Link row seems not clickable .so that I redirect the user. My attempt was to add anchor() tags similar to table definition but its still inactive.

<?php
$con=mysqli_connect($server,$user,$password,$dbname);
// Check connection
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$result = mysqli_query($con,"SELECT * FROM accident_log");

echo "<table border='1'>
<tr>
<th>ID</th>
<th>Link</th>
</tr>";

while($row = mysqli_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['ID'] . "</td>";
echo "<a><td>" . $row['Link'] . "</td></a>";
echo "</tr>";
}
echo "</table>";

mysqli_close($con);
?>
Abel C Dixon
  • 17
  • 1
  • 8

1 Answers1

-4

Learn here if you do not know https://www.w3schools.com

echo '<td><a href="' . $row['link'] . '">' . $row['link'] . '</a></td>';
echo '<td><a href="' . $row['link'] . '" style="background: #09f; color: #fff; padding: 10px 20px;">' . $row['link'] . '</a></td>';
SimpleMix
  • 16
  • 1
  • 3
    Do not suggest w3schools.com for learning PHP. They are know to provide really bad examples. If you want to teach something be kind and explain your answer to the OP. An answer which just tells them to learn something from some website is low quality and might get downvoted. – Dharman Oct 13 '19 at 16:06
  • Examples are excellent, especially for beginners. I don't collect your points. I always answer the question from the new user. – SimpleMix Oct 13 '19 at 16:24