Re: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-05 Thread Rasmus Lerdorf
> Hehe... and to think this whole line of discussion started because > someone advocates list() over () when the latter, IMO, is better because > the former is redundant. That's what it comes down to, really. *shrug* Most syntax is redundant. ($var1, $var2) = foo(); might as well be written a

Re: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-05 Thread Ryan Fischer
> Which is why you see spoofs like this one > http://bbspot.com/News/2001/03/perl_test.html The Perl code in that spoof isn't even valid. ;) And besides, the fact that you can write Perl code that looks like that and still functions is more of a feature than anything. Code that is written like

Re: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-05 Thread Rasmus Lerdorf
> You wrote: > > >Sure it is. Lists or list context. () is not that hard to > > determine > > >what it means. At least, not nearly as hard as you make it out to > > >be for any moderately-experienced programmer. > > > > So it's easy to look it up is if you already know what it does? I > > think

Re: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-05 Thread Mark Maggelet
On Wed, 5 Sep 2001 17:13:59 -0400, Ryan Fischer ([EMAIL PROTECTED]) wrote: >You wrote: >> >Sure it is. Lists or list context. () is not that hard to >> determine >> >what it means. At least, not nearly as hard as you make it out to >> >be for any moderately-experienced programmer. >> >> So it's

Re: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-05 Thread Ryan Fischer
You wrote: > >Sure it is. Lists or list context. () is not that hard to > determine > >what it means. At least, not nearly as hard as you make it out to > >be for any moderately-experienced programmer. > > So it's easy to look it up is if you already know what it does? I > think the majority of

Re: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-05 Thread Mark Maggelet
On Wed, 5 Sep 2001 14:36:59 -0400, Ryan Fischer ([EMAIL PROTECTED]) wrote: >> > You wrote: >> > > ($var1, $var2) is magic. I hate magic. >> > >> > It's not magic. It's just simpler. >> > >> > > What do you look up in the Perl >> > > manual when you hit syntax like that? >> > >> > http://www.perl

Re: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-05 Thread Sheridan Saint-Michel
- Original Message - From: "Ryan Fischer" <[EMAIL PROTECTED]> To: "Mark Maggelet" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, September 05, 2001 1:35 PM Subject: Re: [PHP] Assign multiple variables from mysql_fetch_row() call > Yo

Re: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-05 Thread Ryan Fischer
> > You wrote: > > > ($var1, $var2) is magic. I hate magic. > > > > It's not magic. It's just simpler. > > > > > What do you look up in the Perl > > > manual when you hit syntax like that? > > > > http://www.perldoc.com/perl5.6/pod/perldata.html > > I said "what" not "where". I still maintain t

Re: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-05 Thread Ryan Fischer
You wrote: > >I use list context a lot in PHP and Perl, and I prefer Perl's way of > >doing it *because* it allows you to be as verbose or terse as you > >like. > >PHP, unfortunately, doesn't give you that freedom. > > Hmm... the freedom to write unreadable, unmaintainable code, yes this > is a ve

Re: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-04 Thread Egan
On Tue, 4 Sep 2001 14:29:42 -0700 (PDT), Rasmus Lerdorf <[EMAIL PROTECTED]> 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 eq

Re: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-04 Thread David Robley
On Wed, 5 Sep 2001 06:59, Rasmus Lerdorf wrote: > > In perl I can say something like: > > > >($var1, $var2) = $sqh->fetchrow_array() > > > > > > to assign column values to more than one variable at a time. So I > > tried similar syntax with PHP: > > > > > > ($var1, $var2) = mysql_fetch_r

Re: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-04 Thread Mark Maggelet
>I use list context a lot in PHP and Perl, and I prefer Perl's way of >doing it *because* it allows you to be as verbose or terse as you >like. >PHP, unfortunately, doesn't give you that freedom. Hmm... the freedom to write unreadable, unmaintainable code, yes this is a very important feature.

Re: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-04 Thread Rasmus Lerdorf
> You wrote: > > ($var1, $var2) is magic. I hate magic. > > It's not magic. It's just simpler. > > > What do you look up in the Perl > > manual when you hit syntax like that? > > http://www.perldoc.com/perl5.6/pod/perldata.html I said "what" not "where". I still maintain that if you don't know

Re: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-04 Thread Ryan Fischer
You wrote: > ($var1, $var2) is magic. I hate magic. It's not magic. It's just simpler. > What do you look up in the Perl > manual when you hit syntax like that? http://www.perldoc.com/perl5.6/pod/perldata.html > In PHP the equivalent syntax is: > > list($var1, $var2) = ... Which is longer,

RE: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-04 Thread Alfredeen, Johan
You can use a while loop. Ie: (where $row is the result of a sql query) if ($row = mysql_fetch_array($result)) { do { $var1 = $row["column1"]; $var2 = $row["column2"]; $var2 = $row["column3"]; } while ($row = mysql_fetch_array($resu

Re: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-04 Thread Rasmus Lerdorf
> In perl I can say something like: > >($var1, $var2) = $sqh->fetchrow_array() > > > to assign column values to more than one variable at a time. So I > tried similar syntax with PHP: > > > ($var1, $var2) = mysql_fetch_row($sqh); > > > but could not seem to work it out. > > I know you can