What is in error with the following snippet of code?
$y = 0; //counter
$s_first_name = '';
$s_last_name = '';
$s_email = '';
$sql = "select * from members ";
$result = conn($sql);
if (mysqli_num_rows($result)){
echo "<table align='left' cellpadding='0' cellspacing='0'>
<tr><td> </td></tr>
<tr><td style='font-size:16px; font-weight:bold;'>Name.........................</td>";
echo "<td style='font-size:16px; font-weight:bold;'>Email............................................</td>";
echo "</tr>";
//get the values from the db resultset
$count=0;
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
if ($row["email"] > '') {
// colors white and gray
(($y % 2) == 0) ? $bgcolor = "#ffffff" : $bgcolor = "#c0c0c0";
// colors silver and gray
// (($y % 2) == 0) ? $bgcolor = "#f5f5f5" : $bgcolor = "#c0c0c0";
$s_first_name = $row['fname'];
$s_last_name = $row['lname'];
$s_email = $row['email'];
echo "<tr style='background-color:$bgcolor;'>";
echo "<td>$s_first_name $s_last_name</td>";
echo "<td>$s_email</td>";
$text = "$s_first_name $s_last_name $s_email\n";
fwrite ($enames, $text);
$text = "$s_email\n";
fwrite ($eaddrs, $text);
$count++;
$y++;
}//end if
}//end while
I get the enames and the eaddrs files written with all the members but get only the heading and the first row displayed on the screen.
I know something is wrong but I can't find it.
$y = 0; //counter
$s_first_name = '';
$s_last_name = '';
$s_email = '';
$sql = "select * from members ";
$result = conn($sql);
if (mysqli_num_rows($result)){
echo "<table align='left' cellpadding='0' cellspacing='0'>
<tr><td> </td></tr>
<tr><td style='font-size:16px; font-weight:bold;'>Name.........................</td>";
echo "<td style='font-size:16px; font-weight:bold;'>Email............................................</td>";
echo "</tr>";
//get the values from the db resultset
$count=0;
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
if ($row["email"] > '') {
// colors white and gray
(($y % 2) == 0) ? $bgcolor = "#ffffff" : $bgcolor = "#c0c0c0";
// colors silver and gray
// (($y % 2) == 0) ? $bgcolor = "#f5f5f5" : $bgcolor = "#c0c0c0";
$s_first_name = $row['fname'];
$s_last_name = $row['lname'];
$s_email = $row['email'];
echo "<tr style='background-color:$bgcolor;'>";
echo "<td>$s_first_name $s_last_name</td>";
echo "<td>$s_email</td>";
$text = "$s_first_name $s_last_name $s_email\n";
fwrite ($enames, $text);
$text = "$s_email\n";
fwrite ($eaddrs, $text);
$count++;
$y++;
}//end if
}//end while
I get the enames and the eaddrs files written with all the members but get only the heading and the first row displayed on the screen.
I know something is wrong but I can't find it.