I have webpage that need to be upated for example if the articles in certain tables has passed 7 days then the page will view notification window that there is some old articls need to be updated
How do I check dates across multiple tables?
$sql = "select topic.*
, id.*
from $table_1
, $table2
where (date of the article) < (<date of the article+ 7 days...>)" ;
// the arctile has passed 7 days
$rs = mysql_query($sql);
$nos = mysql_num_rows($rs);
$obj = mysql_fetch_object($rs);
if($row = mysql_fetch_array($sql))
{
// I want to display window that display note
// there is artiles need to be updated and list of those topics"
<script language="javascript" type="text/javascript">
function print_msg(opt,id)
{
if(confirm("show old topics"))
{
window.location="home.php";
}
else
{
return false;
}
}
</script>
//here are the topics need to be updated
echo obj->topic;
}
I think you have to use UNION ALL to join the rows in both the tables. After joining the rows, you can perform a SELECT on the derived table output to check your date condition. Here is the SQL query. I don’t know about PHP syntax.
If you want to fetch only distinct rows among the two tables, change UNION ALL to UNION.
Query: Something along this line in MySQL.
T1 in the above query represents an alias for the derived table output.