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