You are here: Re: Confused by mysqli « PHP Programming Language « IT news, forums, messages
Re: Confused by mysqli

Posted by David Haynes on 07/05/06 11:51

Dodger wrote:
> David Haynes wrote:
>> Dodger wrote:
>> [snip]
>
>> The store->result() method returns a mysqli_result type.
>> You need to use the mysqli_type for the fetch_assoc() method.
>
> Thank you!
>
> Though pardon my saying that that's weird as snake shoes...
> Result objects... *blinks*

Well... its not all that uncommon. Java, for example, hands you a result
which you then have to play with.

>> $cities = array();
>> while( $city = $result->fetch_assoc() ) {
>> $cities[] = $city; // you don't need to supply the $i++ index this way
>> }
>
> I think ... I think I'm gonna end up writing function push {} -- to
> preserve my sanity by doing that bit elsewhere hidden away...

The [] operator is a push operator.

>> $result->free(); // don't forget to free the result memory
>
> Is there a way to lexically scope things, something like my() in
> Perl... so the garbage handling bit can be taken care of automagically
> when things fall out of scope?
>

No. Not really. PHP doesn't really have a good model for memory
management - its based more upon the C(++) of malloc/free. i.e. You are
a big boy and should clean up your own messes.

-david-

 

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

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