Re: Assign multiple variables from mysql_fetch_row() call
| From: | Egan | Date: | Wed, 05 Sep 2001 02:12:39 +0000 |
| Subject: | Re: Assign multiple variables from mysql_fetch_row() call | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-65978@lists.php.net to get a copy of this message | ||
On Tue, 4 Sep 2001 14:29:42 -0700 (PDT), Rasmus Lerdorf
<rasmus@php.net> wrote:
>> In perl I can say something like:
>>
>> ($var1, $var2) = $sqh->fetchrow_array()
>($var1, $var2) is magic. I hate magic. What do you look up in the Perl
>manual when you hit syntax like that? In PHP the equivalent syntax is:
>
>list($var1, $var2) = ...
>
>It does exactly the same thing, and it is legible.
Sorry, I didn't mean to start a flame war.
I only wanted to know if there was a simple way of doing it, without
using a temporary array. The only reason I mentioned perl is because
I did not know any other way to frame the question.
Your suggestion looks like just what I need, thanks!
Egan