如果url已存在于mysql的url表中。 在php脚本中中断操作

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_get_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.