Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2005
    Posts
    5

    Unanswered: 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.

  2. #2
    Join Date
    Apr 2005
    Location
    Baltimore, MD
    Posts
    297
    in MySQL use GROUP_CONCAT

    in php use implode

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •