If not working as expected HELP

  • 17 years ago

    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

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“I invented the term Object-Oriented, and I can tell you I did not have C++ in mind.” - Alan Kay