If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > To flatten an array

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-29-05, 03:08
defcon2000 defcon2000 is offline
Registered User
 
Join Date: Dec 2005
Posts: 5
To flatten an array

Hello,

We have the following code:

$tmpemail = mysql_query("SELECT email_address
FROM users
WHERE users.status = 'Active'", $conn) or die('Query failed: ' . mysql_error());

while ($row = mysql_fetch_array($tmpemail, MYSQL_ASSOC))
{
$recepients = $row["email_address"];
}

The above array $row["email_address"] contains a number of email addresses. We want the variable $recepients to have all the email addresses in it and with semi-colons in between, for example "abc@jjj.com; rabbit@dog.com; babyyou@waggg.com", etc ...

What can be done to flatten this array?

Thank you in advance.
Reply With Quote
  #2 (permalink)  
Old 12-29-05, 13:43
jfulton jfulton is offline
Registered User
 
Join Date: Apr 2005
Location: Baltimore, MD
Posts: 297
in MySQL use GROUP_CONCAT

in php use implode
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On