@ini_set ('memory_limit',"128M");
@set_time_limit (0);
@ini_set ('max_execution_time',0);
include_once("mysql.class.php");
define ("DBHOST", "localhost");
define ("DBNAME", "***");
define ("DBUSER", " *** ");
define ("DBPASS", " *** ");
define ("COLLATE", "cp1251");
$db = new db;
$sql_result = $db->query("SELECT id, title, city, contacts FROM `jb_board`");
while ( $row = $db->get_row ($sql_result) ) {
$sql_result2 = $db->query("SELECT id FROM `jb_board` WHERE title LIKE '".$row['title']."' AND city LIKE '".$row['city']."' AND contacts LIKE '".$row['contacts']."'");
$i=0;
while ( $row2 = $db->get_row ($sql_result2) ) {
if ($i == 0)
{ $i++;
continue;
}
$db->query("DELETE FROM `jb_board` WHERE id = ".$row2['id']);
echo $row2['id']."<br>"; //список ИД фотографии которых скорее всего тоже нужно удалит.
$i++;
}
}