SELECT p.dt, products.id_product
FROM pcalendar p,
(
SELECT DISTINCT p.id_product
FROM prices_test p
WHERE id_product = 837623465
ORDER BY id_product
) products
WHERE p.dt between p.dt AND CURDATE()
if (isset($_REQUEST['update']))
{
$sql = mysqli_query($db, 'SELECT `title`, `link`, `description`, `created_at` FROM `news` ORDER BY `created_at` desc LIMIT 10');
while ($result = mysqli_fetch_array($sql)) {
echo '<div class="item">';
echo '<h2><a href='.$result['link'].'>'.$result['title'].'</a></h2>';
echo '<div class="description">'.$result['description'].'</div>';
echo '<p class="datetime">'.$result['created_at'].'</p>';
echo '</div>';
}
exit();
}
$query = mysqli_query($db, "SELECT COUNT(*) FROM news WHERE title='{$title}'");
$item = mysqli_fetch_row($query);
if ($item[0] == 0) {
mysqli_query($db, "INSERT INTO news (title, link, image, description, created_at) VALUES('{$title}', '{$link}', '{$image}', '{$description}', '{$date}')");
}
$query = mysqli_query($db, "SELECT COUNT(*) FROM news");
$item = mysqli_fetch_row($query);
if ($item[0] > 10) {
mysqli_query($db, "DELETE FROM news ORDER BY `id` ASC LIMIT ".($item[0] - 10));
}