Isaiah Melendez
asked on
PHP Help - URL make clickable
Hello, Experts,
I built a PHP script that queries a database and outputs the results in JS/HTML form. If you could review the code below, I need help how to make the result field URL clickable.
Example:
Name: John Doe
URL: http://google.com
When results display for John, he is able to see the result set for his name and click on http://google.com
Let me know if you need further clarification.
I built a PHP script that queries a database and outputs the results in JS/HTML form. If you could review the code below, I need help how to make the result field URL clickable.
Example:
Name: John Doe
URL: http://google.com
When results display for John, he is able to see the result set for his name and click on http://google.com
Let me know if you need further clarification.
<?php
//fetch.php
$connect = stuff
$output = '';
if(isset($_POST["query"]))
{
$search = mysqli_real_escape_string($connect, $_POST["query"]);
$query = "
SELECT * FROM emp_details
WHERE dept LIKE '%".$search."%'
OR fname LIKE '%".$search."%'
OR lname LIKE '%".$search."%'
OR pkid LIKE '%".$search."%'
OR url LIKE '%".$search."%'
";
}
else
{
$query = "
SELECT * FROM emp_details;
";
}
$result = mysqli_query($connect, $query);
if(mysqli_num_rows($result) > 0)
{
$output .= '
<div class="table-responsive">
<table class="table table bordered">
<tr>
<th>pkid</th>
<th>fname</th>
<th>lname</th>
<th>department Code</th>
<th>url</th>
</tr>
';
while($row = mysqli_fetch_array($result))
{
$output .= '
<tr>
<td>'.$row["pkid"].'</td>
<td>'.$row["fname"].'</td>
<td>'.$row["lname"].'</td>
<td>'.$row["DEPT"].'</td>
<td>'.$row["url"].'</td>
</tr>
';
}
echo $output;
}
else
{
echo 'Data Not Found';
}
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
you can click to anydata...