public static function SortProduct($value){
var_dump($value); die();
$db = Db::getConnection();
$sql = "UPDATE table SET Sort = Sort + 1 WHERE Sort IN (SELECT Sort FROM table WHERE Sort >= :Sort)";
$result = $db->prepare($sql);
$result->bindParam(':Sort', $value, PDO::PARAM_INT);
return $result->execute();
}
$.ajax({
url: 'function.php?news',
success: function(data) {
if (data !== 'NOT_FOUND') {
toastr.success(data,'Новая новость на сайте');
}
else
{
// обработка события когда ничего не найдено
// то есть data === 'NOT_FOUND'
}
}
});
UPDATE table SET Sort = 666 + 1 WHERE Sort = (SELECT Sort FROM table WHERE Sort > 666)
$news = mysql_query("SELECT * FROM `link` WHERE `pokaz` = '0' ORDER BY `id` DESC LIMIT 1 ");
$newrow = mysql_fetch_array($news);
if ($newrow !== false) {
echo $newrow['title'];
mysql_query("UPDATE `link` SET `pokaz` = '1' WHERE `id` = $newrow[id] ");
}
else {
echo "0";
}
$.ajax({
url: 'is-exist-new-records.php',
success: function(data) {
if (data !== '0') {
alert(data);
}
}
});