PHP/MySQL Query help with Two Tables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

julzk
Forum Newbie
Posts: 23
Joined: Fri Oct 30, 2009 4:42 am

Re: PHP/MySQL Query help with Two Tables

Post by julzk »

WOOOOT!!

Code: Select all

$result = mysql_query("SELECT
            j.jobs_id,
            j.jobs_description,
            d.jobs_done_id,
            d.jobs_timedone,
            d.jobs_comment,
            d.jobs_user
        FROM tbl_jobs AS j
        LEFT JOIN tbl_jobs_done AS d
            ON j.jobs_id = d.jobs_id
            AND DATE(d.jobs_date) = DATE(NOW()+INTERVAL 16 HOUR)
        WHERE j.jobs_datetype IN('$everyday', '$dayname', '$wtype')
        ORDER BY jobs_id ASC");
That fixed it! It now clears the old jobs from yesterday and displays new jobs for the next days :)
User avatar
iankent
Forum Contributor
Posts: 333
Joined: Mon Nov 16, 2009 4:23 pm
Location: Wales, United Kingdom

Re: PHP/MySQL Query help with Two Tables

Post by iankent »

julzk wrote:That fixed it! It now clears the old jobs from yesterday and displays new jobs for the next days :)
Glad it worked, but just one thing - doesn't AEDT = UTC + 11:00? In which case using + 16 HOUR will put you 5 hours too far ahead, i.e. you'll see items from 19th at 7pm on 18th
Post Reply