How to increment through records on a weekly basis

I have results for a weekly time sheet that I have dynamically generated on a page. What i want to do is to be able to navigate through these records on a weekly basis. the code below is the query i use to generate the results. My question is...Is it possible to create a variable that would go forward or back in one week increments?

Is this done in the query? or do i need to set up some php variables that accomplish this and use them in the query? any help is appreciated.
$week_query = ("SELECT * from timecard_data
		WHERE WEEK(CURDATE()) = WEEK(job_date) 
		AND emp_id = '$emp';");

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sebastian TalmonSystem Engineer Datacenter SolutionsCommented:

you should have an additional variable containing the offset in weeks from now, for example  $_GET['weekoffset']

you could specify the offset in the URL / Link as  xxx.php?weekoffset=23

$week_query = ("SELECT * from timecard_data
            WHERE WEEK(DATE_SUB(CURDATE(), ".(int)$_GET['weekoffset']." WEEKS)) = WEEK(job_date)
            AND emp_id = '$emp';");

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
adrake9Author Commented:
so if i had a next/previous button on my site I could make the weekoffset=1 or -1 and get the previous or next week?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.