Author Topic: Combine two lists into one  (Read 4122 times)

Pavel

  • Posts: 14
    • View Profile
Combine two lists into one
« on: March 07, 2006, 07:52:15 am »
I wonder if there is a simple way to combine subs from 2 lists into 1 saving their unique IPs?
Pavel Lenshin
NeoProfit Circle

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Combine two lists into one
« Reply #1 on: March 08, 2006, 05:03:48 am »
Here you go!

1. Copy and paste the code below into a new file, ie. custom.php
2. Upload the file to your ListMail folder
3. Browse to it
Code: [Select]
<?php
// place this script in your ListMail folder and browse to it
include('./config.php');
include(
'./admin.php');

$move_from_list '1';
$move_to_list '2';

// cycle all users on "from" list
echo "moving users from list $move_from_list to list $move_to_list - please wait<br>";
flush();
$rows mysql_query("select id,email from $utable where list = '$move_from_list';");
echo @
mysql_num_rows($rows).' users to process<br>';
while(list(
$id,$em)=mysql_fetch_row($rows)){
 
$row mysql_query("select id from $utable where list = '$move_to_list' and email like '$em';");
 
// if not on list move user
 
if(@mysql_num_rows($row)==0mysql_query("update $utable set list = '$move_to_list' where id = '$id';");
 else echo 
"duplicate email $em<br>";
}
echo 
"done!<br>";
?>
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

BGSWebDesign

  • Posts: 625
    • View Profile
    • http://www.bgswebdesign.com
Combine two lists into one
« Reply #2 on: March 08, 2006, 06:21:01 am »
Hi DW,

Quote
1. Copy and paste the code below into a new file, ie. custom.php


Thanks a million, this was long overdue and will help tremendously!!!  As we discussed before, this is one of those 'Extras' you could sell as part of a membership, or as an 'add-on', think about it...  we've talked about it many times - I want to see you making a good living from LMP   :)

What we really would need is a selector box, select list 1, select list 2, instead of manually updating the php file every time ...
also - another option is really needed to make this script fully functional:
Move To, or Copy To - preserving the old users in the original List so they are not removed from the other list, just copied to the new list...

What do you think, DW?
Thanks,
-Brett
http://www.bgswebdesign.com/Contact-Us.php

*** I do custom List Mail Pro installations ***
Contact me through my website (above)

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Combine two lists into one
« Reply #3 on: March 08, 2006, 11:04:40 am »
When checkboxes, selections, and 'all list' or 'all result' operations come to the user database page this will all be very easy.
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

Pavel

  • Posts: 14
    • View Profile
Combine two lists into one
« Reply #4 on: March 08, 2006, 02:34:07 pm »
Thanks a lot Dean, you are very helpful.

I think this feature has long been awaited, especially in the form of a button somewhere in the "User Database" window :)

Thanks.
Pavel Lenshin
NeoProfit Circle