This topic is locked

Driving me bananas

8/22/2007 7:50:21 AM
PHPRunner General questions
M
morpheus author

right, I have two tables in my stock database, all been written in PHPrunner, this is the last little bit I'm stuck on, somebody must have the answer???????
USERS:

uniqueid

id

email

tel
ITEMS:

uniqueid <not linked to uniqueid in users>

id <same as id in users>

description

amend_date

blah

blah

blah
What I need to do is create an HTML email with a table of items that each user currently has (or items where amend date < 7 days ago) this will automatically remind people that they have stock outstanding, I assume the best way to go would be as follows
join both tables on id field (username)
query joined table to only get data where issued_date < (now() - 7days)
cycle through the email addresses sending a table of data for each email address
This works in theory but I'm really struggling with it, is there any php wizards out there that can shed some light on this???
my project is nearly complete and this is the last little bit thats stopping us switching off the MSaccess based system (limited to two users) and going to a full intranet based system.
Any help would be greatly appreciated
regards
Jason

Sergey Kornilov admin 8/22/2007

This looks like a job for simple PHP script that needs to work outside of PHPRunner.
Here is the recommended reading:
How to write a JOIN SQL query:

http://www.webcheatsheet.com/sql/interacti...al/sql_join.php
MySQL date functions:

http://dev.mysql.com/doc/refman/5.0/en/dat...-functions.html
I believe you can use the following:
where DATE_ADD(issued_date, INTERVAL 7 DAY) < now()
To loop through the data and email results you can use the following article:

http://www.freewebmasterhelp.com/tutorials/phpmysql/4