Problem with simple if statement...
Posted: Sun Apr 28, 2013 11:00 pm
Hey all,
I can't seem to get this if statement to work. It will set the value in a style sheet to the screen output if the value returned from my table is "Y" or a different value if the table returns "N". The first record in my table has a value of "Y", however the if statement ALWAYS evaluates to "N". Here is the code:
while ($row = mysql_fetch_assoc($result))
{
if($r_n&1)
{
echo "<tr bgcolor=\"BDBDBD\">";
} else {
echo "<tr bgcolor=\"FBF8EF\">";
}
echo "<td><h5>",$r_n,"</h5></td>";
echo "<td><h5>",$row['member_id'],"</h5></td>";
echo "<td><h5>",$row['firstname']," ",$row['lastname'],"</h5></td>";
echo "<td align=\"left\"><h5>",$row['join_date'],"</h5></td>";
echo "<td align=\"center\"><h5>",$row['a_lo'],"</h5></td>";
$v_act = $row['act'];
if ($v_act = "Y")
{
$v_act_fc = "<h7>";
$v_act_fc_end = "</h7>";
}
if ($v_act = "N")
{
$v_act_fc = "<h3>";
$v_act_fc_end = "</h3>";
}
echo "<td align=\"center\">",$v_act_fc,$row['act'],$v_act_fc_end,"</td>";[/color][/color]
echo "<td align=\"center\"><h5>",$row['lck'],"</h5></td>";
echo "<td align=\"center\"><h5>",$row['lli_date'],"</h5></td>";
echo "<td align=\"center\"><h5>",$row['lli_time'],"</h5></td>";
echo "<td align=\"center\"><h5>",$row['llo_date'],"</h5></td>";
echo "<td align=\"center\"><h5>",$row['llo_time'],"</h5></td>";
echo "<td><h5>",$row['login'],"</h5></td>";
echo "<td><h5>",$row['email'],"</h5></td>";
echo "<td><h5>",$row['pers_img'],"</h5></td>";
echo "<td align=\"center\"><h5>",$row['img_date'],"</h5></td>";
echo "</tr>";
$r_n++;
}
Any help would be greatly appreciated.
I can't seem to get this if statement to work. It will set the value in a style sheet to the screen output if the value returned from my table is "Y" or a different value if the table returns "N". The first record in my table has a value of "Y", however the if statement ALWAYS evaluates to "N". Here is the code:
while ($row = mysql_fetch_assoc($result))
{
if($r_n&1)
{
echo "<tr bgcolor=\"BDBDBD\">";
} else {
echo "<tr bgcolor=\"FBF8EF\">";
}
echo "<td><h5>",$r_n,"</h5></td>";
echo "<td><h5>",$row['member_id'],"</h5></td>";
echo "<td><h5>",$row['firstname']," ",$row['lastname'],"</h5></td>";
echo "<td align=\"left\"><h5>",$row['join_date'],"</h5></td>";
echo "<td align=\"center\"><h5>",$row['a_lo'],"</h5></td>";
$v_act = $row['act'];
if ($v_act = "Y")
{
$v_act_fc = "<h7>";
$v_act_fc_end = "</h7>";
}
if ($v_act = "N")
{
$v_act_fc = "<h3>";
$v_act_fc_end = "</h3>";
}
echo "<td align=\"center\">",$v_act_fc,$row['act'],$v_act_fc_end,"</td>";[/color][/color]
echo "<td align=\"center\"><h5>",$row['lck'],"</h5></td>";
echo "<td align=\"center\"><h5>",$row['lli_date'],"</h5></td>";
echo "<td align=\"center\"><h5>",$row['lli_time'],"</h5></td>";
echo "<td align=\"center\"><h5>",$row['llo_date'],"</h5></td>";
echo "<td align=\"center\"><h5>",$row['llo_time'],"</h5></td>";
echo "<td><h5>",$row['login'],"</h5></td>";
echo "<td><h5>",$row['email'],"</h5></td>";
echo "<td><h5>",$row['pers_img'],"</h5></td>";
echo "<td align=\"center\"><h5>",$row['img_date'],"</h5></td>";
echo "</tr>";
$r_n++;
}
Any help would be greatly appreciated.