In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
says...
> Unless it is a typo, the line that reads:
>
> if (image == 'NULL') { echo '<p></p></td>'; }
>
> should read:
>
> if ($image == 'NULL') { echo '<p></p></td>'; }
> ^
>
> You forgot the $ in front of image.
>
> HTH
>
> MB
> [EMAIL PROTECTED] said:
>
> > Hi sorry back again.
> >
> > Thanks for helping me get the code right. Sorry being stupid again, I am
> having problems with an if / else statement.
> >
> > I am trying the following but it does not seem to work, what the problem
> is, that I am saying if the image name field in the database is empty to
> print nothing, and if it contains data to print that field name, as the a
> href is in the code which pulls the image, if the field is empty it should
> show nothing, but what happens is the image is shown in the browser and its
> not blank.
> >
> > Here is the revised code:
> >
> > echo ("<tr> \n");
> > echo ("<td width=\"72%\" valign=\"top\"><h3>$title</h3> \n");
> > echo ("<p>$description</p></td> \n");
> > echo ("<td width=\"28%\" valign=\"top\"> \n");
> > if (image == 'NULL') { echo '<p></p></td>'; }
> > else { echo '<p><img src="' . $image . '" width="201"
> height="160"></p></td>'; }
> > echo ("</tr> \n");
> > }}
> >
> >
> > If someone can see the problem it would be most helpful.
In addition to Maureen's point, you are currently checking whether the
variable $image contains the string NULL; you can test for NULL (without
the quotes) or better, use the function empty() to test whether $image has
a value.
--
David Robley
Temporary Kiwi!
Quod subigo farinam
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php