Page 1 of 1

Efficient Code?

Posted: Sun Apr 30, 2006 12:38 pm
by acidHL
Hi Guys,

I'm developing a system for a client that is used to arrange the swap and rental of holiday homes.
I need to implement a cron job that runs through new properties (based in 3 tables, one for homes, boats and caravans) and e-mail's users who have expressed an interest in the property type and location.

I have a little psuedo-code, i'm just wondering if this is an efficient way to do it?

Code: Select all

For each property type
{
    For each new property in property_table (selected based on date)
    {
         Find members in members database with matching type and country preferences
         If the member isn't already in the temporary table
         {
              add match details temporary table and add link to the property
         } else {
              add a link to the existing record
         }
    }
}

Run through each item in the temporary table and e-mail the information to the member
It seems to me i'll be running a lot of queries if this database gets big. Does anybody have a better way of doing this?

I intend to e-mail using PHPmailer and I am working with PHP4.

Posted: Mon May 01, 2006 5:44 am
by timvw
It all depends on your tables and queries.. And the functions your SQL DBMS supports.. As long as we don't know them it's hard to say something...

Posted: Mon May 01, 2006 6:28 am
by acidHL
When I get chance i'll write some code and post a copy of the DB schema. Thanks anyway.