You are here: Re: What's wrong with this simple line of code? « PHP Programming Language « IT news, forums, messages
Re: What's wrong with this simple line of code?

Posted by Geoff Berrow on 03/10/07 12:59

Message-ID: <4FvIh.2507$FG1.2028@newssvr27.news.prodigy.net> from Mike
Russell contained the following:

>> <?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)

Umm...ITYM
echo '<a href="' . $book_review_url . '">Click here for reviews for
'.$title.' on Amazon.com</a>';

But being lazy I'd usually do

echo "<a href='$book_review_url '>Click here for reviews for $title on
Amazon.com</a>";

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

 

Navigation:

[Reply to this 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

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