Hi, I want to be able to extract a comma seperated list into seperate variables that I can use to limit a loop that displays different <OPTION>s in a select list.
Here's the senario - user has access to different photo albums - each album has a name, and a row ID (it's primary key). Admin sets up users, selecting any combintation of albums that the user can access. Since I'm using a <select> with multiple turned on, the resulting data that is inserted into my DB is "1,2,5" or something similar.
How can i use explode on the
$rs['allowed_albums']
variable to get which album IDs the user is allowed to see.
I know that
$album = explode($rs['allowed_albums'])
is going to give me:
$album[0] = 1
$album[1] = 2
$album[2] = 5
But how can I use the array variables above to do an if () {} statement while looping out the result set of a query of the albums table. Basically i want to build a <select> statement that only shows album 1, 2 and 5 for this user. It has to be dynamic, becuase, admin can add new albums at will.
ANY help on this is greatly apprecieated! Thanks!