Reply to Re: What's wrong with this simple line of code?

Your name:

Reply:


Posted by John C. Frickson on 03/09/07 23:25

On 2007-03-09 17:03, fishmonger1972@gmail.com wrote:
> 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
> don't get any error messages. So, I'm very perplexed because it
> doesn't work as I'd like.
>
> I'm trying to see if $book_review_url is defined.. then if it is I
> want it to make 'Click here for reviews for $title' to be hyperlinked
> by the url that is in the database in $book_review_url. Any help
> would be appreciated!
>
>
> <?php if (defined($book_review_url)) echo "<a href=\"$book_review_url
> \">Click here for reviews for $title on Amazon.com</a>"; ?>

defined() only works for constants, not variables.

If you know that the variable $book_review_url exists and you
want to just check if it's not empty, use
if ($book_review_url != "")

If you don't know if the variable even exists, use
if (exists($book_review_url) && $book_review_url != "")

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация