what about
  if (strlen($result["FLRPLAN_3"]) > 0)


-----Original Message-----
From: markbm [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 2:02 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Problem with Not displaying HTML if data not found


I am trying to develop a page that, in certain places, I only want it to
display the <TR> and <TD>s if data is found for a given field.  For example,
if I only have an image for the  first floorplan of a house, I do NOT have
an image for the  second floorplan of a house, then show the first floorplan
image only.....skip over that next row because the field in the db is empty.

The problem that I'm having is that the syntax that I've been using to
define "empty" in the db field does not always work.  The code reads:

if ($result[FLRPLAN_2]<>" ")  {
   printf ("<tr>");
                 printf ("<td colspan=3 bgcolor=#F0F8FF>");
                 printf ("<font size=5> <b>Second Floor Plan:<b>
</td></font>")  ;

              printf ("</tr>") ;
                 printf ("<tr>");
                 printf ("<td colspan=3 >") ;
                     echo "<img
src='http://www.website.com/index_files/main_files/$planid/"; .
mysql_result($result, 0,'FLRPLAN_2')."'>'";
                 printf (" </td>") ;
              printf ("</tr> ");
                };



            if ($result[FLRPLAN_3]<>" ")  {;
              printf ("<tr>");
                printf ("<td colspan=3 bgcolor=#F0F8FF><font size=5>
<b>Third Floor Plan:<b> ");
                printf ("</td></font>   ");
             printf ("</tr>          ");
             printf ("<tr>           ");
                printf ("<td colspan=3 >");
                  echo "<img
src='http://www.website.com/index_files/main_files/$planid/"; .
mysql_result($result, 0,'FLRPLAN_3')."'>'";
                printf ("</td>          ");
             printf ("</tr>          ");
             };


I have tried:

1.              if ($result[FLRPLAN_3]<>" ")  {;
2.              if ($result[FLRPLAN_3]<>"")  {;
3.              if ($result[FLRPLAN_3]<>'')  {;
4.              if ($result[FLRPLAN_3]<>' ')  {;
5.              if ($result[FLRPLAN_3]<>NULL)  {;

and none seem to work correctly (i.e. blank field in db, but HTML row shows
up with missing image......or image is in db, but no HTML row shows up.  If
it helps, each of the "image" fields are varchar(125)....basically I just
have the name of the image file, and then a pointer to the web server
directory structure....

Any ideas would be greatly appreciated.  Thanks.

Mark



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to