Re: [PHP] REPOST: converting multiple URL values for the same variable into an array

2001-07-17 Thread Garth Dahlstrom

Kurt,

You might have some luck with adding [], I seem
to remember that making arrays for form posts, 
so it might do gets too...

http://myhost/playlist.pls?song[]=100song[]=101song[]=102

and if you always end up with an array using [], 
you might change the condition to 
count($song)  1 or something for:

   if ( is_array( $song ) ) {

   else {

   }

Good Luck

-Garth

---
http://www.northern.ca

On Mon, 16 Jul 2001 20:03:50 -0700 Kurt Lieber wrote:

 I posted this late on Sunday afternoon, so it may have been overlooked.
 I haven't figured it out yet, so I'm reposting in the hopes someone can
 help. Thanks.
 
 ---
 
 I'm modifying some code for ampache (ampache.kveton.com) and have run
 into a snag that I'm not sure I understand completely.
 
 Part of the code produces a URL similar to the following:
 
 http://myhost/playlist.pls?song=100song=101song=102
 
 and $song then gets passed to this function:
 
 function get_song_path_from_id ( $song ) {
   GLOBAL $dbh, $db_name;
 
   $songs = '';
   $count = 0;
 
   if ( is_array( $song ) ) {
 while ( list($k,$v) = each($song) ) {
   //does some cool stuff
 }
   }
   else {
 //does some other stuff
   }
   return ($songs);
 }
 
 So, am I correct in assuming that $song will never be considered an
 array? (basically, given the above code and URL, $song will always equal
 102)
 
 I'm new to PHP, and since I didn't write the original code, I'm not sure
 if this is a bug, or something that I just don't fully understand.
 Assuming it is a bug, can anyone offer some suggestions on how to take
 the URL and parse it out and input the values into an array called
 $song?
 (get_song_path_from_id() is used by several other parts of the code, so
 any modifications to that code would need to leave the rest of the
 functionality
 intact)
 
 Thanks.
 
 --kurt
 
 P.S.  If anyone is looking for a simple, easy-to-use (and set up) mp3
 manager, I highly recommend ampache.  It doesn't have a bunch of bells 
 whistles (which I don't want) -- it simply provides a simple, effective
 way to manage playlists and play your mp3 songs from anywhere.
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED] To
 contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] REPOST: converting multiple URL values for the same variable into an array

2001-07-16 Thread Jason Murray

Hi Kurt,

 So, am I correct in assuming that $song will never be considered an
 array? (basically, given the above code and URL, $song will 
 always equal 102)

If .pls is a PHP file, then in my experience yes you're right.

However, I've never seen a PHP file called .pls, it may be
something else. Java Servlets for example will allow you to
overload variables like that on a URL line and will indeed
produce an array.

I could be wrong, though.

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Developer, Melbourne IT
Work now, freak later!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] REPOST: converting multiple URL values for the same variable into an array

2001-07-16 Thread Matthew Loff



If PHP won't overload them to an array, you could parse $QUERY_STRING
manually.


-Original Message-
From: Jason Murray [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 16, 2001 11:06 PM
To: 'Kurt Lieber'; 'PHP General List (E-mail)'
Subject: RE: [PHP] REPOST: converting multiple URL values for the same
variable into an array


Hi Kurt,

 So, am I correct in assuming that $song will never be considered an 
 array? (basically, given the above code and URL, $song will always 
 equal 102)

If .pls is a PHP file, then in my experience yes you're right.

However, I've never seen a PHP file called .pls, it may be something
else. Java Servlets for example will allow you to overload variables
like that on a URL line and will indeed produce an array.

I could be wrong, though.

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Developer, Melbourne IT
Work now, freak later!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] REPOST: converting multiple URL values for the same variable into an array

2001-07-16 Thread Kurt Lieber

Sorry -- I should have clarified that .pls has been added as a php file
type in httpd.conf.  

-Original Message-
From: Jason Murray [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 16, 2001 8:06 PM
To: 'Kurt Lieber'; 'PHP General List (E-mail)'
Subject: RE: [PHP] REPOST: converting multiple URL values for the same
variable into an array


Hi Kurt,

 So, am I correct in assuming that $song will never be considered an 
 array? (basically, given the above code and URL, $song will always 
 equal 102)

If .pls is a PHP file, then in my experience yes you're right.

However, I've never seen a PHP file called .pls, it may be something
else. Java Servlets for example will allow you to overload variables
like that on a URL line and will indeed produce an array.

I could be wrong, though.

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Developer, Melbourne IT
Work now, freak later!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]