How - alter php file to find items within certain date range

cerio

Proficient

Posts: 263

Loc: UK

3+ Months Ago

I have php files that find items in my database and display them on a webpage. I want to create links that make it find and display items from all categories in the database that have a date not more than 7 days from the current date. The php file shown below, currently finds and displays items in a specific category and displays them on a web page, it also reads their dates and adds an icon to any item displayed on the page that is no more than one week old, another icon if up to two weeks old, another icon for up top 3 weeks and another icon for those up to 4 weeks old. I want to have a link on my home page that will open a page that displays items from ALL the categories in the database (not just those in one category) that have been added within the last week. Once I've worked out how to do that I will also do links to show items that have been added within 2,3 and 4 weeks but I'll start with those added within the past 7 days.

I don't know php, so I'm hoping I can do it by fiddling with php files that already exist, as I also don't know anyone who writes php. The code below was written for me by an ex-colleague whom I no longer know, so can't ask for help.

I am hoping I can alter a current php file for that, the one below, to do it...

<tr><td width="100%" align="center" valign="center">No products in this category at the moment</td></tr>

<?php

}

?>

</table>

<p align="center"> <?php echo $pagingLink; ?></p><br />

It would get the date from Table: tbl_product and on that table it is the field pd_date

Can anyone tell me how to alter the code above to have it find items that have a date not more than 7 days from the current date, please

Once I get that sorted out, I'll need to know how to add a link to my home page that gets that php file to display the page showing the latest items but I'll get back to that; first I need to create the php page. I'd probably make the row of 'New' icons at the top of the pages into the links that display the new items, called up by the php file, whereas those icons are currently just there as icons that show folk what is new, the icons themselves aren't linked to anything. However, as I said, fist things first; I need the php file amended to find the new items before worrying about the rest.

If you need to see the above code up and running, the site is http://www.wafuku.co.uk and you just choose any category, such as this page, http://wafuku.co.uk/index.php?c=38 to see what that code produces on the site currently. (I have a shopping/collecting addiction that led me, over the years, to own hundreds and hundreds of vintage Japanese kimonos and other Japanese things till I couldn't move for them, so I am now trying to sell many of them off and recoup the money I squandered on them, hence the existence of that site)