$('#delphoto').val(JSON.stringify(delphoto));
if(isset($_POST['delphoto']))
{
$delphoto = json_encode($_POST['delphoto']);
}
foreach ($delphoto as $arr) {
$sql = "DELETE FROM `gb_mbd1`.`rating_photo` WHERE `rating_photo`.`id` = '$elid' AND `rating_photo`.`photo` = '$arr';";
mysqli_query($link,$sql);
}