Insert rows, split by certain number
On our website i have installed a newsletter add-on.
All the emailadresses (3000) of the recepients are stored in a table called: jos_jnews_subscribers
The recepients are identified by a subscriber_id
There also a table called jos_jnews_listssubscribers.
In this table are the recepients that are "member" of a certain newsletter.
The newsletter id's are stored in a column called list_id
To make a user member of a newsletter, I must connect the subscriber_id to a list_id
I have this query that dumps all the users of jos_jnews_subscribers, into jos_jnews_listssubscribers:
I would like to have this query adapted, so i splits the rows into chuncks of, lets say, 100 rows.
$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");
$sql = "INSERT INTO `jos_jnews_listssubscribers`
B.id as list_id,
A.id as subsriber_id,
A.subscribe_date as subdate,
(0) as unsubdate,
(0) as unsubscribe,
A.params as params
FROM jos_jnews_subscribers A, jos_jnews_lists B
WHERE B.id = '17'";
$query = mysql_query($sql) or die(mysql_error());
So, the first hundred rows must become member of list_id 17,
The second hundred rows must become member of list_id 18 and so on.
Can this be done ?
Some advise or a kick into the right direction would be greatly appreciated !!
Thanks is advance,