开发者

Search MySql database for a HTML link using PHP

I have mysql table that contatins item_id and link columns the link column contains html tags and the actual link. now I want to search the database for a link that doesn't contain html tags what is the best way to do this in 开发者_开发百科php?


The easy answer depends on assumptions you can make based on what you know about the data.

If these links were inserted programmatically, and you trust your own code to create well-formed links, you can eliminate anything that includes the link closure.

SELECT mytable.item_id FROM mytable WHERE mytable.link NOT LIKE '%</a>%'


you could concatenate the raw url with tags and search with this or use the like compare method from mysql

select * from urls where link like '%http://google.com%'
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜