it's the mysql_result()... try this... echo "<img src='http://www.website.com/index_files/main_files/$planid/" . $result["FLRPLAN_2"] . "'>'";
mysql_result($result, 0,'FLRPLAN_2') ^----------- you're always looking at the first row rf: http://www.php.net/manual/en/function.mysql-result.php -----Original Message----- From: markbm [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 23, 2002 2:29 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Problem with Not displaying HTML if data not found When I changed this line, it still gives me the same problem. My db field is a varchar(125)...could that have anything to do with it? Basically, the first time, without data in the field...it works fine and the <TR> is not displayed, but when I add data back into the field, nothing changes...its like it does not recognize that something is back in the field. I did a commit on the db each time, and cleared the browser cache, etc. Mark "Martin Towell" <[EMAIL PROTECTED]> wrote in message 6416776FCC55D511BC4E0090274EFEF5034CFB9D@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF5034CFB9D@EXCHANGE... > 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php