Jump to content

Select records fortnightly


retro

Recommended Posts

I accidentally marked my previous thread as solved (although technically, the original issue was!), so I'll ask my final part of the question here!

 

The database takes an order with a ship date.  It also has a tick box to state if the order should be repeated weekly.  Thanks to Barand, I have the following query, which works great:

 

SELECT id, customer, baen, date
FROM orders
WHERE (date = CURDATE() AND recur = 0) OR (DAYOFWEEK(date) = DAYOFWEEK(CURDATE()) AND recur = 1)

 

However, I now need to be able to list orders that are to be delivered fortnightly.  So, for example:

 

An order was delivered on Monday 14 April.  This order was to be repeated fortnightly.  Therefore, on 21 April, it should not show on the list, but it should on 28 April.

 

I have thought about this, and can't see a way of doing it!  Perhaps somehow determine whether it is an odd or even week?  Or is there an easier way?

 

Thanks in advance for any help - it is greatly appreciated!

Link to comment
Share on other sites

I'm now getting:

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in ..... on line 18

 

Line 18 is the line after the query:

 

$total = mysql_num_rows($result);

 

It was working fine on the weekly one.  Any ideas?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.