You are here: Re: [PHP] Newbie Question re substr « PHP « IT news, forums, messages
Re: [PHP] Newbie Question re substr

Posted by Richard Lynch on 03/08/05 21:14

Jackson Linux wrote:
> On 8 Mar 2005, at 11:40, Richard Lynch wrote:
>
>>>> 1. $content = substr($article['content'], 0 200); // get first
>>>> 200
>>>> chars is choking, and I've looked in docs and can't understand why.
>>>> I get
>>>>
>>>> Parse error: parse error, unexpected T_LNUMBER in
>>>> /usr/www/users/domain/dynamic/templates/substr.htm on line 57
>>
>> In this line, PHP is somehow encountering a T_NUMBER (a number) where
>> it
>> *expects* to see something else.
>>
>> Like a comma.
>>
>> Look between your 0 and 200 very carefully.
>>
>
>
> Thanks for taking the time. I had suspected that earlier, but when I
> put it in all sorts of OTHER stuff happened.
>
> Then I saw your post and tried again. I saw that I had made another
> mistake later on. So you've solved that part - thanks!.
>
> Except....Except it doesn't pull the content from the db and substr it
> to 200 characters. It pulls the id number and the title no problem, and
> I am sure that $article['content'] points to the right place (or at
> least it's named right) but it's just not getting the content:

Put in a var_dump($article) where you think you have 'content' right.

See what you have.

Make sure 'content' is in your list of fields you are retrieving.

--
Like Music?
http://l-i-e.com/artists.htm

 

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

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