|
Posted by Mike Russell on 03/10/07 10:21
<fishmonger1972@gmail.com> wrote in message
news:1173481411.332250.5390@64g2000cwx.googlegroups.com...
> I'm a librarian trying to put a finishing touch on an online materials
> catalog. The line below seems to do nothing in my program.. And I
....
> <?php if (defined($book_review_url)) echo "<a href=\"$book_review_url
> \">Click here for reviews for $title on Amazon.com</a>"; ?>
Others have mentioned use of isset(). Two other errors are that you should
not escape the quotes in this situation, and use . to concatenate strings:
echo "<a href=" . $book_review_url . ">Click here for reviews for $title on
Amazon.com</a>"
(watch for line breaks in this posted message)
There are some things you can do to make writing code like this easier. You
can use an IDE with a built-in syntax checker to find errors as you type
them in, instead of later - eclipse is my current favorite, and there are
other excellent ones, or use php -l to do a quick syntax check. Also, copy
code that others have written, rather than create it yourself from scratch.
--
Mike Russell
www.curvemeister.com/forum/
[Back to original message]
|