SELECT resource.pagetitle, resource.uri, product.id, product.price, img.url AS thumb
FROM `ms2_products` AS product
JOIN `site_content` AS resource ON resource.id = product.id
LEFT JOIN `ms2_product_files` AS img ON img.product_id = product.id
WHERE img.path LIKE "%360x270%" AND img.rank=0
AND <добавить новое условие>
ORDER BY product.id DESC
LIMIT 12
Вот под Твою XML-ку обработчик на PHP.
Проверяет на уже существующий в базе ID и Login. Если TRUE - не вносит.
mysql_connect("localhost", "xmluploader", "xmluploader") or die(mysql_error());
mysql_select_db("xmluploader") or die(mysql_error());
$xmlURL = "xml.xml";
$sxml = simplexml_load_file($xmlURL);
foreach($sxml->user as $user) {
$id = stripslashes($user->attributes()['id']);
$login = stripslashes($user->attributes()['login']);
$realname = stripslashes($user->attributes()['realname']);
$item_1 = stripslashes($user->items->item_1->attributes()['img']);
$item_2 = stripslashes($user->items->item_2->attributes()['img']);
$query = mysql_query("SELECT COUNT(*) FROM users WHERE login='$login' OR id='$id'") or die(mysql_error());
$user = mysql_fetch_row($query);
$total = $user[0];
if ("$total" == 0) {
$sql = ("INSERT INTO users (id,login, realname, item_1, item_2) VALUES('$id','$login', '$realname', '$item_1', '$item_2')");
$result = mysql_query($sql) or die("Error ".mysql_error());
} else {
echo 'ID или Login - существуют!';
}
}