You are here: Re: space in object attribute name « PHP Language « IT news, forums, messages
Re: space in object attribute name

Posted by kevin bailey on 11/24/05 18:18

Nick wrote:

> kevin bailey wrote:
>> hi,
>>
>> using pg_fetch_object() to get a row from a recordset.
>>
>> the recordset was extracted from a view on a database.
>>
>> the view has fields in it where the the field name contains spaces 'Base
>> Total' etc.
>>
>> now when i refer to the field using
>>
>> $total_base = "Total Base";
>> $base_total = $row->$total_base;
>>
>> it works ok.
>>
>> but to be neater is there anyway that:
>>
>> $base_total = $row->'Total Base';
>
> Have you tried
>
> $row->{'Total Base'}

have now and it works fine - marvellous!

i presume the curly braces are a way of php defining a sort of place holder
which is similar to how variables are defined at times - like {$varname}

thanks for the help,

kev

 

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

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