Hello!
I have a very simple PHP script that extracts data from a MySQL DB and displays it in a table. One of the columns contains IP addresses that I'd like to convert into a link preceeded with "
I'm not an expert in PHP and cannot claim the following script as my own. I can however take bits out of other scripts and join them to do what I need. This one has me a little confused.
Here's my code (that doesn't work)for creating the table
So, what this should do is convert each IP address in the "IP Address" column into a link. Eg - 192.168.1.1 whould be converted into a link that when clicked would open the web address
This should be a no brainer I would think but not being a programmer I would appreciate a little assistance.
Thanks!
I have a very simple PHP script that extracts data from a MySQL DB and displays it in a table. One of the columns contains IP addresses that I'd like to convert into a link preceeded with "
I'm not an expert in PHP and cannot claim the following script as my own. I can however take bits out of other scripts and join them to do what I need. This one has me a little confused.
Here's my code (that doesn't work)for creating the table
Code:
// printing table rows
while($row = mysql_fetch_row($result))
{
echo "<tr>";
// $row is array... foreach( .. ) puts every element
// of $row to $cell variable
foreach($row as $cell)
if ($row=="IP Address")
{
echo "<td nowrap='nowrap'><font face='Verdana'><font size='1'><a href ="[URL unfurl="true"]https://"$cell></a></font></td>";[/URL]
}
else {
echo "<td nowrap='nowrap'><font face='Verdana'><font size='1'>$cell</font></td>";
}
echo "</tr>\n";
}
So, what this should do is convert each IP address in the "IP Address" column into a link. Eg - 192.168.1.1 whould be converted into a link that when clicked would open the web address
This should be a no brainer I would think but not being a programmer I would appreciate a little assistance.
Thanks!