I have spent hours trying to get this to work - I have had enough - though new to PHP I am not new to programming so this is just so frustrating:
Background : I am reading a MySQL data base and as normal testing a returned value for purposes of execution - no surprises so far.
When executing the IF statement ALWAYS returns FALSE and gives the wrong answer - HELP
Basic Function ===>>
function resultstablerow($text1, $bool1, $text2, $bool2)
{
print "$bool1\n";
print "$bool2\n";
print "<tr>\n";
print "<td width=50% align=right>\n";
print "$text1 \n";
if ($bool1 = 1
)
{print "<img border=0 src=../images/Green%20Tick.bmp>\n";}
else
{print "<img border=0 src=../images/Red%20X.bmp>\n";}
print "</td>\n";
print "<td width=50%>\n";
if ($bool2 = 1
)
{print "<img border=0 src=../images/Green%20Tick.bmp>\n";}
elseif ($bool2 = 0
)
{print "<img border=0 src=../images/Red%20X.bmp>\n";}
else
{print "\n";}
print "$text2\n";
print "</td>\n";
print "</tr>\n";
}
Calling Mechanism =======>>>
print "<table border=0 cellpadding=0 cellspacing=0 style=border-collapse: collapse bordercolor=#111111 width=100% id=AutoNumber1>\n";
//some debug code
print "Start\n";
print "type ";
print gettype($selecteddetail->AFamilyFriendlyLogis);
print gettype($selecteddetail->ANatureSilenceLogis);
print "$selecteddetail->AFamilyFriendlyLogis\n";
print "$selecteddetail->ANatureSilenceLogis\n";
print "Middle\n";
print $selecteddetail->AFamilyFriendlyLogis;
print $selecteddetail->ANatureSilenceLogis;
print "End\n";
resultstablerow("A Family Friendly Logis",$selecteddetail->AFamilyFriendlyLogis,"A Nature (Silent) Logis",$selecteddetail->ANatureSilenceLogis);
resultstablerow("A Vineyard Logis",$selecteddetail->AVineyardLogis,"A Cycling Logis",$selecteddetail->ACyclingLogis);
resultstablerow("A Hiking Logis",$selecteddetail->AHikingLogis,"A Fishing Logis",$selecteddetail->AFishingLogis);
resultstablerow("A Snow Logis",$selecteddetail->ASnow_Logis,"",9);
print "</table>\n";
The various MySQL fields (ie $selecteddetail->AFamilyFriendlyLogis) are all defined as TinyInt.
The code always prints the last section of the IF else pair/triplette
for example first always puts red X - second always puts ""
What, can someone help me, is wrong - i have tried `, " and ' and numerics
Many thanks in advance
Kindest regards
Sean MCPoland
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).