Hmm.
Doing some simple testing here,
<?php
//connect to data base
//extractl list of emails of newsletter subscribers
$tbl_name1="testmembers";
$query="SELECT email, confirm_code FROM $tbl_name1";
$result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());
while ($row = mysql_fetch_row($result)) {
echo $row['email'].'<br>';
echo $row['confirm_code'].'<br>';
}
echo "Newsletter sent";
?>
gives me some blank screen above 'Newsletter sent'.
<?php
//connect to data base
//extractl list of emails of newsletter subscribers
$tbl_name1="testmembers";
$query="SELECT email, confirm_code FROM $tbl_name1";
$result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());
while ($row = mysql_fetch_row($result)) {
foreach ($row as $whatsthere){
echo $whatsthere.'<br>';
}}
echo "Newsletter sent";
?>
gives me on the screen as expected:
email address 1
confirm code 1
email address 2
confirm code 2
So it seems the foreach loop is needed - I just can't figure out how to write it so that I can call up the email and corresponding confirm code as I write the email handling code. I have a feeling I am almost there and will have a 'doh!' moment when I see the solution.