Author Topic: When someone orders, remove from list 2, add to list 1  (Read 1799 times)

mike2

  • Posts: 193
    • View Profile
When someone orders, remove from list 2, add to list 1
« on: January 19, 2006, 08:26:10 am »
Ok, I searched for something similar but couldn't find it, even though I'm sure I saw something like this before.

What I want to do is when someone places and order from my site I want to:

1)  Check if there email exists on list 2 (confirmed or not), if so, simply move them to list 1, with a seq of 99 (so they don't get that lists followups) and change to confirmed.

2)  If they aren't on list 2 or on list 1, add there email to list 1 with a seq of 99.

3) If they are on list 1 already, change there seq to 99 and confirmed (if not already).

If you could help with the PHP code to accomplish this, I'd throw it in at the end of my order system, thanks a ton!

mike2

  • Posts: 193
    • View Profile
When someone orders, remove from list 2, add to list 1
« Reply #1 on: January 20, 2006, 02:27:16 pm »
Bump > any thing on this?

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
When someone orders, remove from list 2, add to list 1
« Reply #2 on: January 22, 2006, 11:07:38 am »
Mike,

Sorry I've been really busy.  Let's see...

How about this...
Code: [Select]
// relative path to LMP
$path_to_lmp = '../';
include($path_to_lmp.'config.php');
include($path_to_lmp.'admin.php');
mysql_query("update $utable set list = '1', cnf = '1', cseq = '99' where list = '2' and email like '".addslashes($email)."';");
$aff = mysql_affected_rows();
if($aff==0){
 // insert the user to list 1
 // See: http://listmailpro.com/forum/index.php?topic=172.0 for LMinsert.php script
 include($path_to_lmp.'LMinsert.php');
 LMinsert('1',$email,'','','','','','','','','','','','','99');
}


Note that you'll need to re-specify your MySQL access info in LMinsert.php, which takes care of the heavy work such as dupe checking and unique id creation.

Regards, DW
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting