开发者

MySQL inserting text before and after value

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 addresse开发者_如何转开发s 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">ip.goes.here</a>

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.


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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜