I am trying to update a table called "Orders" when a row on another table (called "store") is more than 30 days old.
When a value on "store" is created, it is given a timestamp of the time it was added to the table. But as soon as that value turns over 30 days old, I need it to get the ID (which is a column that has a unique ID per row) of that cell, and check the table called "orders" for that ID, and update another column where that ID is present.
So far, I've written this, but it is clearly wrong:
<?php
include ('connectdb.php');
$query = $db->query("SELECT * FROM store WHERE open_time < (NOW()- INTERVAL 30 DAYS)");
$update = $db->prepare("UPDATE orders SET notified=-1 WHERE unique_id=$query");
$db = null;
?>