RE: [PHP] Problem with Not displaying HTML if data not found
it's the mysql_result()... try this... echo "'"; 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 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 and 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 (""); > printf (""); > printf (" Second Floor Plan: > ") ; > > printf ("") ; > printf (""); > printf ("") ; > echo " src='http://www.website.com/index_files/main_files/$planid/"; . > mysql_result($result, 0,'FLRPLAN_2')."'>'"; > printf (" ") ; > printf (" "); > }; > > > > if ($result[FLRPLAN_3]<>" ") {; > printf (""); > printf (" > Third Floor Plan: "); > printf (" "); > printf (" "); > printf (" "); > printf (""); > echo " src='http://www.website.com/index_files/main_files/$planid/"; . > mysql_result($result, 0,'FLRPLAN_3')."'>'"; > printf (" "); > printf (" "); > }; > > > 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
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 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 and 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 (""); > printf (""); > printf (" Second Floor Plan: > ") ; > > printf ("") ; > printf (""); > printf ("") ; > echo " src='http://www.website.com/index_files/main_files/$planid/"; . > mysql_result($result, 0,'FLRPLAN_2')."'>'"; > printf (" ") ; > printf (" "); > }; > > > > if ($result[FLRPLAN_3]<>" ") {; > printf (""); > printf (" > Third Floor Plan: "); > printf (" "); > printf (" "); > printf (" "); > printf (""); > echo " src='http://www.website.com/index_files/main_files/$planid/"; . > mysql_result($result, 0,'FLRPLAN_3')."'>'"; > printf (" "); > printf (" "); > }; > > > 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
RE: [PHP] Problem with Not displaying HTML if data not found
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 and 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 (""); printf (""); printf (" Second Floor Plan: ") ; printf ("") ; printf (""); printf ("") ; echo "'"; printf (" ") ; printf (" "); }; if ($result[FLRPLAN_3]<>" ") {; printf (""); printf (" Third Floor Plan: "); printf (" "); printf (" "); printf (" "); printf (""); echo "'"; printf (" "); printf (" "); }; 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