Hi everyone. First time caller, long time listener here
Hopefully someone can help me, I just cant get my head around this one.
What I need to do is take some data from one MySQL database and write it to another
(note the table names and fields are different)
I can connect to both databases, no problem
And I can pull the data from the first database and create a multidimensional array from it, no problem
My problem is I can’t work out how to take some data from the multidimensional array and write that to the second MySql
A simplified example of the multidimensional array is as below:
[1] => Array
(
[customer_id] => 7
[store_id] => 0
[firstname] => Joe
[lastname] => Blog
[email] => [email protected]
[telephone] => 12345
[fax] => 12345
[password] => bb48dd4cd03a2f5a859c79da2e18df50
[cart] =>
[wishlist] =>
[newsletter] => 1
[address_id] => 11
[status] => 1
[approved] => 1
[customer_group_id] => 6
[ip] => 202.68.92.35
=> 2011-01-17 13:41:13
)
[2] => Array
(
[customer_id] => 16
[store_id] => 0
[firstname] => Jane
[lastname] => Blog
[email] => [email protected]
[telephone] => 123456
[fax] => 123456
[password] => dd22141acb5ea065acd5ed773729c98f
[cart] =>
[wishlist] =>
[newsletter] => 1
[address_id] => 24
[status] => 1
[approved] => 1
[customer_group_id] => 8
[ip] => 221.164.208.60
[date_added] => 2011-01-19 14:27:47
)
My table in the second MySQL is wp_newletter and has columns:
id (auto increment)
name
email
Can anyone please give me some help on writing the Update code using the array above (variable = $newarray)
And has a clause that if there is already an email of the same value not to add it
Most appreciative of any help given
Kind regards
Julie