I need help with a array. Here is what i am trying to do. I have a sql database that has 2 col in it. col a “switch” col b “Emailaddress” so database would llok like this:
AAALT [email][email protected]
AAALT [email][email protected]
AALTEST2 [email][email protected]
AALTEST2 [email][email protected]
This is what i want to do. I want to send a email to the persons that is in the database. But i want to combined the names to one email that have the same col a. So if i run this it should send out 2 different emails. 1 for AAALT in the subject and then person with that in col a, 1 for AALTEST2 in the subject and then person with that in col a.
i can get it into a array. I just cant figure out on how to step through it to get the information that i need.
Below is the code that i have so far:
[code=php]while($r[]=mysql_fetch_array($getBWM));
{
echo “<pre>”;
array_pop($r);
print_r($r);
Here is the output of it.
Array
(
[0] => Array
(
[0] => AAALT
[Switch] => AAALT
[1] => [email][email protected]
[Emailaddress] =>
)
[1] => Array
(
[0] => AAALT
[Switch] => AAALT
[1] => [email protected]
[Emailaddress] => [email protected]
)
[2] => Array
(
[0] => AALTEST2
[Switch] => AALTEST2
[1] => [email protected]
[Emailaddress] => [email protected]
)
[3] => Array
(
[0] => AALTEST2
[Switch] => AALTEST2
[1] => [email protected]
[Emailaddress] => [email protected]
)
)