I use this code below for getting data from a different website by using PHP curl function.everything is working fine but I am getting duplicate data into my database when the website will reload or refresh.
duplicate data screenshot
does there have any why based on this code below to stop inserting duplicate data on reload if the data already exist in the Mysql database? I search on google about this issue but don't get any useful information.
if(isset($_POST['url'],$_POST['theme'])){
$db = new Mysqli("localhost" , "iamniloy_wp###" , "(5uSE6[3OP" , "iamniloy_#@");
$url = $db->real_escape_string($_POST['url']);
$theme = $db->real_escape_string($_POST['theme']);
$query = "INSERT INTO twist_data ( url,theme ) VALUES ('$url','$theme')";
$db->query($query);
}