You are here: Re: fetch_array() « PHP Programming Language « IT news, forums, messages
Re: fetch_array()

Posted by Geoff Berrow on 12/23/06 07:33

Message-ID: <4v41ucF1ahjbpU1@mid.individual.net> from Kim André Akerø
contained the following:

>> > $random=rand(1,5);
>> > $query="SELECT Message FROM random_quote WHERE MessageID=$random";
>> > $result = mysql_query($query) or die(mysql_error());
>> > $row= mysql_fetch_array($result);
>> > echo $row['Message'];
>>
>> Better use mysql_fetch_assoc or pass the parameter MYSQL_ASSOC than
>> use mysql_fetch_array as is, there's no need for the indexed elements.
>
>Why go through all the hoops of using arrays when you only need the one
>element?

For the novice, the less functions you have to learn the easier it
becomes. My way, you get rather more than you need, but it works in
every instance.

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

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