Re: [PHP-DB] reading arrays within a field from mysql and separating the values

2001-09-11 Thread Andrey Hristov

, ok, sorry for the disturbance. greets.

Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS


- Original Message - 
From: "Rick Emery" <[EMAIL PROTECTED]>
To: "'Andrey Hristov'" <[EMAIL PROTECTED]>; "Rick Emery" <[EMAIL PROTECTED]>
Sent: Tuesday, September 11, 2001 4:39 PM
Subject: RE: [PHP-DB] reading arrays within a field from mysql and separating the 
values


> yes, is corrrect concerning implode(), which constructs a string from an
> array.  He already has string, such as "name1,name2,name3,name4".  What he
> wants is:
>  $array[0] = "name1"
>  $array[1] = "name2"
>  $array[2] = "name3"
>  $array[3] = "name4"
> 
>  $array = explode(",", "name1,name2,name3,name4" ) performs this
> function
> 
> -Original Message-
> From: Andrey Hristov [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 11, 2001 8:32 AM
> To: Rick Emery
> Subject: Re: [PHP-DB] reading arrays within a field from mysql and
> separating the values
> 
> 
> so implode(' ') separates the values with . i use implode() many
> times when using files. $content =
> implode('',file('file_name'));
> 
> Andrey Hristov
> IcyGEN Corporation
> http://www.icygen.com
> BALANCED SOLUTIONS
> 
> 
> ----- Original Message -
> From: "Rick Emery" <[EMAIL PROTECTED]>
> To: "'Andrey Hristov'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Tuesday, September 11, 2001 4:30 PM
> Subject: RE: [PHP-DB] reading arrays within a field from mysql and
> separating the values
> 
> 
> > Andrey,
> >
> > He wants to separate values from an array, not combine them into an array.
> >
> > -Original Message-
> > From: Andrey Hristov [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, September 11, 2001 8:26 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] reading arrays within a field from mysql and
> > separating the values
> >
> >
> > $my_arr= array(.);
> > echo implode(' ',array_keys($my_arr));
> >
> > Andrey Hristov
> > IcyGEN Corporation
> > http://www.icygen.com
> > BALANCED SOLUTIONS
> >
> >
> > - Original Message -
> > From: "Rick Emery" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, September 11, 2001 4:23 PM
> > Subject: RE: [PHP-DB] reading arrays within a field from mysql and
> > separating the values
> >
> >
> > > the explode() should have worked on that.  Something like:
> > >
> > > $query = "SELECT DCD_Access FROM userdb WHERE ID = $user_ID";
> > > $result4 = mysql_query($query) or die("Error");
> > > $DCD = mysql_fetch_array($result4);
> > > $myarray = explode( ",", $DCD['DCD_Access'] );
> > > foreach ( $myarray as $val )
> > >   {
> > > print "$val\n";
> > >   }
> > >
> > > -----Original Message-----
> > > From: Robert Trembath [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, September 10, 2001 4:45 PM
> > > To: Rick Emery
> > > Subject: Re: [PHP-DB] reading arrays within a field from mysql and
> > > separating the values
> > >
> > >
> > > NASA, BBCI
> > >
> > > I want to separate these but I either get what I show above as a single
> > > value or the word "Array" depending on how I try to get to the values.
> > >
> > >
> > > - Original Message -
> > > From: "Rick Emery" <[EMAIL PROTECTED]>
> > > Newsgroups: php.db
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Monday, September 10, 2001 4:27 PM
> > > Subject: RE: [PHP-DB] reading arrays within a field from mysql and
> > > separating the values
> > >
> > >
> > > > Robert,
> > > >
> > > > Do a manual "SELECT DCD_Access FROM userdb WHERE ID = ### "
> > > > and send the results.  I'd like to see exactly what is in that field.
> > The
> > > > explode() should have provided an array of values
> > > >
> > > > rick
> > > >
> > > > -Original Message-
> > > > From: Robert Trembath [mailto:[EMAIL PROTECTED]]
> > > > Sent: Monday, September 10, 2001 3:53 PM
> > > > To: Rick Emery
> > > > Subject: Re: [PHP-DB] reading arrays

RE: [PHP-DB] reading arrays within a field from mysql and separating the values

2001-09-11 Thread Rick Emery

Andrey,

He wants to separate values from an array, not combine them into an array.

-Original Message-
From: Andrey Hristov [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 11, 2001 8:26 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] reading arrays within a field from mysql and
separating the values


$my_arr= array(.);
echo implode(' ',array_keys($my_arr));

Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS


- Original Message - 
From: "Rick Emery" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 11, 2001 4:23 PM
Subject: RE: [PHP-DB] reading arrays within a field from mysql and
separating the values


> the explode() should have worked on that.  Something like:
> 
> $query = "SELECT DCD_Access FROM userdb WHERE ID = $user_ID";
> $result4 = mysql_query($query) or die("Error");
> $DCD = mysql_fetch_array($result4);
> $myarray = explode( ",", $DCD['DCD_Access'] );
> foreach ( $myarray as $val )
>   {
> print "$val\n";
>   }
> 
> -Original Message-
> From: Robert Trembath [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 10, 2001 4:45 PM
> To: Rick Emery
> Subject: Re: [PHP-DB] reading arrays within a field from mysql and
> separating the values
> 
> 
> NASA, BBCI
> 
> I want to separate these but I either get what I show above as a single
> value or the word "Array" depending on how I try to get to the values.
> 
> 
> - Original Message -
> From: "Rick Emery" <[EMAIL PROTECTED]>
> Newsgroups: php.db
> To: <[EMAIL PROTECTED]>
> Sent: Monday, September 10, 2001 4:27 PM
> Subject: RE: [PHP-DB] reading arrays within a field from mysql and
> separating the values
> 
> 
> > Robert,
> >
> > Do a manual "SELECT DCD_Access FROM userdb WHERE ID = ### "
> > and send the results.  I'd like to see exactly what is in that field.
The
> > explode() should have provided an array of values
> >
> > rick
> >
> > -Original Message-
> > From: Robert Trembath [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, September 10, 2001 3:53 PM
> > To: Rick Emery
> > Subject: Re: [PHP-DB] reading arrays within a field from mysql and
> > separating the values
> >
> >
> > The same as my original message.
> >
> > - Original Message -
> > From: "Rick Emery" <[EMAIL PROTECTED]>
> > Newsgroups: php.db
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, September 10, 2001 3:40 PM
> > Subject: RE: [PHP-DB] reading arrays within a field from mysql and
> > separating the values
> >
> >
> > > what do you mean by it made no difference?  Did you examine each
element
> > in
> > > $myarray?  What were the results?
> > >
> > > rick
> > >
> > > FYI...I tried to send directly to you and the message was bounced back
> > > -Original Message-
> > > From: Robert Trembath [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, September 10, 2001 3:30 PM
> > > To: Rick Emery
> > > Subject: Re: [PHP-DB] reading arrays within a field from mysql and
> > > separating the values
> > >
> > >
> > > Rick,
> > > I tried it and it made no difference. Could you give me a more
complete
> > > example?
> > > Thanks for the help.
> > > Robert
> > > - Original Message -
> > > From: "Rick Emery" <[EMAIL PROTECTED]>
> > > To: "'Robert Trembath'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
> > > Sent: Monday, September 10, 2001 3:03 PM
> > > Subject: RE: [PHP-DB] reading arrays within a field from mysql and
> > > separating the values
> > >
> > >
> > > > $myarray=explode(",",$DCD['DCD_Access']);
> > > >
> > > > Then, cycle through each $myarray element as you've done below.
> > > >
> > > > -Original Message-
> > > > From: Robert Trembath [mailto:[EMAIL PROTECTED]]
> > > > Sent: Monday, September 10, 2001 2:55 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [PHP-DB] reading arrays within a field from mysql and
> > > > separating the values
> > > >
> > > >
> > > > Hello everyone,
> > > >
> > > > Ran into a problem trying to get this to work. I have multiple names
> in
> > a
> > > > mysql field (DCD_Access) that contains &q

Re: [PHP-DB] reading arrays within a field from mysql and separating the values

2001-09-11 Thread Andrey Hristov

$my_arr= array(.);
echo implode(' ',array_keys($my_arr));

Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS


- Original Message - 
From: "Rick Emery" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 11, 2001 4:23 PM
Subject: RE: [PHP-DB] reading arrays within a field from mysql and separating the 
values


> the explode() should have worked on that.  Something like:
> 
> $query = "SELECT DCD_Access FROM userdb WHERE ID = $user_ID";
> $result4 = mysql_query($query) or die("Error");
> $DCD = mysql_fetch_array($result4);
> $myarray = explode( ",", $DCD['DCD_Access'] );
> foreach ( $myarray as $val )
>   {
> print "$val\n";
>   }
> 
> -Original Message-
> From: Robert Trembath [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 10, 2001 4:45 PM
> To: Rick Emery
> Subject: Re: [PHP-DB] reading arrays within a field from mysql and
> separating the values
> 
> 
> NASA, BBCI
> 
> I want to separate these but I either get what I show above as a single
> value or the word "Array" depending on how I try to get to the values.
> 
> 
> - Original Message -
> From: "Rick Emery" <[EMAIL PROTECTED]>
> Newsgroups: php.db
> To: <[EMAIL PROTECTED]>
> Sent: Monday, September 10, 2001 4:27 PM
> Subject: RE: [PHP-DB] reading arrays within a field from mysql and
> separating the values
> 
> 
> > Robert,
> >
> > Do a manual "SELECT DCD_Access FROM userdb WHERE ID = ### "
> > and send the results.  I'd like to see exactly what is in that field.  The
> > explode() should have provided an array of values
> >
> > rick
> >
> > -Original Message-
> > From: Robert Trembath [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, September 10, 2001 3:53 PM
> > To: Rick Emery
> > Subject: Re: [PHP-DB] reading arrays within a field from mysql and
> > separating the values
> >
> >
> > The same as my original message.
> >
> > - Original Message -
> > From: "Rick Emery" <[EMAIL PROTECTED]>
> > Newsgroups: php.db
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, September 10, 2001 3:40 PM
> > Subject: RE: [PHP-DB] reading arrays within a field from mysql and
> > separating the values
> >
> >
> > > what do you mean by it made no difference?  Did you examine each element
> > in
> > > $myarray?  What were the results?
> > >
> > > rick
> > >
> > > FYI...I tried to send directly to you and the message was bounced back
> > > -Original Message-
> > > From: Robert Trembath [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, September 10, 2001 3:30 PM
> > > To: Rick Emery
> > > Subject: Re: [PHP-DB] reading arrays within a field from mysql and
> > > separating the values
> > >
> > >
> > > Rick,
> > > I tried it and it made no difference. Could you give me a more complete
> > > example?
> > > Thanks for the help.
> > > Robert
> > > - Original Message -
> > > From: "Rick Emery" <[EMAIL PROTECTED]>
> > > To: "'Robert Trembath'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > > Sent: Monday, September 10, 2001 3:03 PM
> > > Subject: RE: [PHP-DB] reading arrays within a field from mysql and
> > > separating the values
> > >
> > >
> > > > $myarray=explode(",",$DCD['DCD_Access']);
> > > >
> > > > Then, cycle through each $myarray element as you've done below.
> > > >
> > > > -Original Message-
> > > > From: Robert Trembath [mailto:[EMAIL PROTECTED]]
> > > > Sent: Monday, September 10, 2001 2:55 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [PHP-DB] reading arrays within a field from mysql and
> > > > separating the values
> > > >
> > > >
> > > > Hello everyone,
> > > >
> > > > Ran into a problem trying to get this to work. I have multiple names
> in
> > a
> > > > mysql field (DCD_Access) that contains "name1, name2, name3, name4"
> and
> > I
> > > > want read this information as an array so I can use these values to
> > > populate
> > > > a pull-down list using a while or foreach loop. Below is the code I
> > used,
> > > > but I get the values as a single ent

RE: [PHP-DB] reading arrays within a field from mysql and separating the values

2001-09-11 Thread Rick Emery

the explode() should have worked on that.  Something like:

$query = "SELECT DCD_Access FROM userdb WHERE ID = $user_ID";
$result4 = mysql_query($query) or die("Error");
$DCD = mysql_fetch_array($result4);
$myarray = explode( ",", $DCD['DCD_Access'] );
foreach ( $myarray as $val )
  {
print "$val\n";
  }

-Original Message-
From: Robert Trembath [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 4:45 PM
To: Rick Emery
Subject: Re: [PHP-DB] reading arrays within a field from mysql and
separating the values


NASA, BBCI

I want to separate these but I either get what I show above as a single
value or the word "Array" depending on how I try to get to the values.


- Original Message -
From: "Rick Emery" <[EMAIL PROTECTED]>
Newsgroups: php.db
To: <[EMAIL PROTECTED]>
Sent: Monday, September 10, 2001 4:27 PM
Subject: RE: [PHP-DB] reading arrays within a field from mysql and
separating the values


> Robert,
>
> Do a manual "SELECT DCD_Access FROM userdb WHERE ID = ### "
> and send the results.  I'd like to see exactly what is in that field.  The
> explode() should have provided an array of values
>
> rick
>
> -Original Message-
> From: Robert Trembath [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 10, 2001 3:53 PM
> To: Rick Emery
> Subject: Re: [PHP-DB] reading arrays within a field from mysql and
> separating the values
>
>
> The same as my original message.
>
> - Original Message -----
> From: "Rick Emery" <[EMAIL PROTECTED]>
> Newsgroups: php.db
> To: <[EMAIL PROTECTED]>
> Sent: Monday, September 10, 2001 3:40 PM
> Subject: RE: [PHP-DB] reading arrays within a field from mysql and
> separating the values
>
>
> > what do you mean by it made no difference?  Did you examine each element
> in
> > $myarray?  What were the results?
> >
> > rick
> >
> > FYI...I tried to send directly to you and the message was bounced back
> > -Original Message-
> > From: Robert Trembath [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, September 10, 2001 3:30 PM
> > To: Rick Emery
> > Subject: Re: [PHP-DB] reading arrays within a field from mysql and
> > separating the values
> >
> >
> > Rick,
> > I tried it and it made no difference. Could you give me a more complete
> > example?
> > Thanks for the help.
> > Robert
> > - Original Message -
> > From: "Rick Emery" <[EMAIL PROTECTED]>
> > To: "'Robert Trembath'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > Sent: Monday, September 10, 2001 3:03 PM
> > Subject: RE: [PHP-DB] reading arrays within a field from mysql and
> > separating the values
> >
> >
> > > $myarray=explode(",",$DCD['DCD_Access']);
> > >
> > > Then, cycle through each $myarray element as you've done below.
> > >
> > > -Original Message-
> > > From: Robert Trembath [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, September 10, 2001 2:55 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP-DB] reading arrays within a field from mysql and
> > > separating the values
> > >
> > >
> > > Hello everyone,
> > >
> > > Ran into a problem trying to get this to work. I have multiple names
in
> a
> > > mysql field (DCD_Access) that contains "name1, name2, name3, name4"
and
> I
> > > want read this information as an array so I can use these values to
> > populate
> > > a pull-down list using a while or foreach loop. Below is the code I
> used,
> > > but I get the values as a single entry no matter what I try. This
query
> > > brings a single result row "name1, name2, name3, name4". Here's the
> code:
> > >
> > > $result4 = mysql_query( "SELECT DCD_Access FROM userdb WHERE ID =
> > > '$user_ID'");
> > > $DCD = mysql_fetch_array ( $result4 );
> > >
> > > print " \n
> > > \n
> > > \n
> > > None\n
> > > Within Gel\n";
> > > foreach ( $DCD as $val )
> > > {
> > > print "$val\n";
> > > }
> > > print "   \n
> > >   \n";
> > >
> > > This returns HTML like:
> > >
> > > 
> > > 
> > > 
> > > None
> > > Within Gel
> > >

RE: [PHP-DB] reading arrays within a field from mysql and separating the values

2001-09-10 Thread Rick Emery

Robert,

Do a manual "SELECT DCD_Access FROM userdb WHERE ID = ### "
and send the results.  I'd like to see exactly what is in that field.  The
explode() should have provided an array of values

rick

-Original Message-
From: Robert Trembath [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 3:53 PM
To: Rick Emery
Subject: Re: [PHP-DB] reading arrays within a field from mysql and
separating the values


The same as my original message.

- Original Message -
From: "Rick Emery" <[EMAIL PROTECTED]>
Newsgroups: php.db
To: <[EMAIL PROTECTED]>
Sent: Monday, September 10, 2001 3:40 PM
Subject: RE: [PHP-DB] reading arrays within a field from mysql and
separating the values


> what do you mean by it made no difference?  Did you examine each element
in
> $myarray?  What were the results?
>
> rick
>
> FYI...I tried to send directly to you and the message was bounced back
> -Original Message-
> From: Robert Trembath [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 10, 2001 3:30 PM
> To: Rick Emery
> Subject: Re: [PHP-DB] reading arrays within a field from mysql and
> separating the values
>
>
> Rick,
> I tried it and it made no difference. Could you give me a more complete
> example?
> Thanks for the help.
> Robert
> - Original Message -
> From: "Rick Emery" <[EMAIL PROTECTED]>
> To: "'Robert Trembath'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Monday, September 10, 2001 3:03 PM
> Subject: RE: [PHP-DB] reading arrays within a field from mysql and
> separating the values
>
>
> > $myarray=explode(",",$DCD['DCD_Access']);
> >
> > Then, cycle through each $myarray element as you've done below.
> >
> > -Original Message-
> > From: Robert Trembath [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, September 10, 2001 2:55 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] reading arrays within a field from mysql and
> > separating the values
> >
> >
> > Hello everyone,
> >
> > Ran into a problem trying to get this to work. I have multiple names in
a
> > mysql field (DCD_Access) that contains "name1, name2, name3, name4" and
I
> > want read this information as an array so I can use these values to
> populate
> > a pull-down list using a while or foreach loop. Below is the code I
used,
> > but I get the values as a single entry no matter what I try. This query
> > brings a single result row "name1, name2, name3, name4". Here's the
code:
> >
> > $result4 = mysql_query( "SELECT DCD_Access FROM userdb WHERE ID =
> > '$user_ID'");
> > $DCD = mysql_fetch_array ( $result4 );
> >
> > print " \n
> > \n
> > \n
> > None\n
> > Within Gel\n";
> > foreach ( $DCD as $val )
> > {
> > print "$val\n";
> > }
> > print "   \n
> >   \n";
> >
> > This returns HTML like:
> >
> > 
> > 
> > 
> > None
> > Within Gel
> > name1, name2,
> name3,
> > name4
> > name1, name2,
> name3,
> > name4
> > name1, name2,
> name3,
> > name4
> > name1, name2,
> name3,
> > name4
> >  
> >  
> >
> > What I need is to get:
> >
> > 
> > 
> > 
> > None
> > Within Gel
> > name1
> > name2
> > name3
> > name4
> >  
> >  
> >
> > Anyone know how to fix this?
> > Robert
> >
> >
> >
> >
> > --
> > PHP Database 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 Database 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 Database 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-DB] reading arrays within a field from mysql and separating the values

2001-09-10 Thread Rick Emery

what do you mean by it made no difference?  Did you examine each element in
$myarray?  What were the results?

rick

FYI...I tried to send directly to you and the message was bounced back
-Original Message-
From: Robert Trembath [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 3:30 PM
To: Rick Emery
Subject: Re: [PHP-DB] reading arrays within a field from mysql and
separating the values


Rick,
I tried it and it made no difference. Could you give me a more complete
example?
Thanks for the help.
Robert
- Original Message -
From: "Rick Emery" <[EMAIL PROTECTED]>
To: "'Robert Trembath'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, September 10, 2001 3:03 PM
Subject: RE: [PHP-DB] reading arrays within a field from mysql and
separating the values


> $myarray=explode(",",$DCD['DCD_Access']);
>
> Then, cycle through each $myarray element as you've done below.
>
> -Original Message-
> From: Robert Trembath [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 10, 2001 2:55 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] reading arrays within a field from mysql and
> separating the values
>
>
> Hello everyone,
>
> Ran into a problem trying to get this to work. I have multiple names in a
> mysql field (DCD_Access) that contains "name1, name2, name3, name4" and I
> want read this information as an array so I can use these values to
populate
> a pull-down list using a while or foreach loop. Below is the code I used,
> but I get the values as a single entry no matter what I try. This query
> brings a single result row "name1, name2, name3, name4". Here's the code:
>
> $result4 = mysql_query( "SELECT DCD_Access FROM userdb WHERE ID =
> '$user_ID'");
> $DCD = mysql_fetch_array ( $result4 );
>
> print " \n
> \n
> \n
> None\n
> Within Gel\n";
> foreach ( $DCD as $val )
> {
> print "$val\n";
> }
> print "   \n
>   \n";
>
> This returns HTML like:
>
> 
> 
> 
> None
> Within Gel
> name1, name2,
name3,
> name4
> name1, name2,
name3,
> name4
> name1, name2,
name3,
> name4
> name1, name2,
name3,
> name4
>  
>  
>
> What I need is to get:
>
> 
> 
> 
> None
> Within Gel
> name1
> name2
> name3
> name4
>  
>  
>
> Anyone know how to fix this?
> Robert
>
>
>
>
> --
> PHP Database 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 Database 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 Database 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-DB] reading arrays within a field from mysql and separating the values

2001-09-10 Thread Rick Emery

$myarray=explode(",",$DCD['DCD_Access']);

Then, cycle through each $myarray element as you've done below.

-Original Message-
From: Robert Trembath [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 2:55 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] reading arrays within a field from mysql and
separating the values


Hello everyone,

Ran into a problem trying to get this to work. I have multiple names in a
mysql field (DCD_Access) that contains "name1, name2, name3, name4" and I
want read this information as an array so I can use these values to populate
a pull-down list using a while or foreach loop. Below is the code I used,
but I get the values as a single entry no matter what I try. This query
brings a single result row "name1, name2, name3, name4". Here's the code:

$result4 = mysql_query( "SELECT DCD_Access FROM userdb WHERE ID =
'$user_ID'");
$DCD = mysql_fetch_array ( $result4 );

print " \n
\n
\n
None\n
Within Gel\n";
foreach ( $DCD as $val )
{
print "$val\n";
}
print "   \n
  \n";

This returns HTML like:




None
Within Gel
name1, name2, name3,
name4
name1, name2, name3,
name4
name1, name2, name3,
name4
name1, name2, name3,
name4
 
 

What I need is to get:




None
Within Gel
name1
name2
name3
name4
 
 

Anyone know how to fix this?
Robert




-- 
PHP Database 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 Database 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-DB] reading arrays within a field from mysql and separating the values

2001-09-10 Thread Rick Emery

$myarray=explode(",",$DCD['fieldname']);

In the above, substitute "fieldname" for the name of the field which
contains name1,name2,name3,name4,...
Then, cycle through each $myarray element as you've done below.

-Original Message-
From: Robert Trembath [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 2:55 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] reading arrays within a field from mysql and
separating the values


Hello everyone,

Ran into a problem trying to get this to work. I have multiple names in a
mysql field (DCD_Access) that contains "name1, name2, name3, name4" and I
want read this information as an array so I can use these values to populate
a pull-down list using a while or foreach loop. Below is the code I used,
but I get the values as a single entry no matter what I try. This query
brings a single result row "name1, name2, name3, name4". Here's the code:

$result4 = mysql_query( "SELECT DCD_Access FROM userdb WHERE ID =
'$user_ID'");
$DCD = mysql_fetch_array ( $result4 );

print " \n
\n
\n
None\n
Within Gel\n";
foreach ( $DCD as $val )
{
print "$val\n";
}
print "   \n
  \n";

This returns HTML like:




None
Within Gel
name1, name2, name3,
name4
name1, name2, name3,
name4
name1, name2, name3,
name4
name1, name2, name3,
name4
 
 

What I need is to get:




None
Within Gel
name1
name2
name3
name4
 
 

Anyone know how to fix this?
Robert




-- 
PHP Database 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 Database 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-DB] reading arrays within a field from mysql and separating the values

2001-09-10 Thread Robert Trembath

Hello everyone,

Ran into a problem trying to get this to work. I have multiple names in a
mysql field (DCD_Access) that contains "name1, name2, name3, name4" and I
want read this information as an array so I can use these values to populate
a pull-down list using a while or foreach loop. Below is the code I used,
but I get the values as a single entry no matter what I try. This query
brings a single result row "name1, name2, name3, name4". Here's the code:

$result4 = mysql_query( "SELECT DCD_Access FROM userdb WHERE ID =
'$user_ID'");
$DCD = mysql_fetch_array ( $result4 );

print " \n
\n
\n
None\n
Within Gel\n";
foreach ( $DCD as $val )
{
print "$val\n";
}
print "   \n
  \n";

This returns HTML like:




None
Within Gel
name1, name2, name3,
name4
name1, name2, name3,
name4
name1, name2, name3,
name4
name1, name2, name3,
name4
 
 

What I need is to get:




None
Within Gel
name1
name2
name3
name4
 
 

Anyone know how to fix this?
Robert




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