tags:

views:

14

answers:

1

I have made an SQL query that picks out web statistics from a database. This information is being picked out on a weekly basis, outputted as a HTML table and then sent by email.

One of the rows contains the IP addresses of the visitors. I would like to make the IP address a link leadning to "http://whois.domaintools.com/ip.goes.here".

In HTML:

<a href="http://whois.domaintools.com/ip.goes.here"&gt;ip.goes.here&lt;/a&gt;

Is there some way to put the A HREF code around each IP with an SQL query, or must I run some sort of script to convert each IP to a link?

I do not want to write anything to the database, only read from it.

+1  A: 

You can use the concat function.

select concat(
  "<a href=\"http://whois.domaintools.com/", my_ip_column, 
  "\">", my_ip_column, "</a>"
) as my_ip_link from my_table;
no
Works flawlessly. Thanks a lot!
nctrnl