开发者

If url already exists in url table in mysql. Break operation in php script

I have this code which echos the body and title in the browser, this then gets stored to the database but I wanted to know how I can add a statement which checks to see if the url is already in the url table from the repository database. Something like (echo "url already exists")

$url = $_GET["url"];
include("simple_html_dom.php");
$html = file_ge开发者_JAVA百科t_html($url);
echo $html->find('body', 0);
echo $html->find('title', 0);


Just make the url unique in your database.

Or do a select first or do an insert on duplicate key update, etc.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜