dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: array contents into string

  1. #1
    Join Date
    Apr 2003
    Posts
    137

    array contents into string

    I know I've done this before, but I just can't remember how.

    <?php
    $address = array();
    $address[0]="123 nearstreet";
    $address[1]="333 middlestreet";
    $address[2]="321 farstreet";
    // several addresses

    $multi_address = $address[0]." ".$address[1]." ".$address[2];

    echo $multi_address;
    ?>

    should output:

    123 nearstreet 333 middlestreet 321 farstreet

    ************************************

    What I need is to retrieve several addresses from the "address" table into an array and into $multi_address as a single string.
    My attempt:

    <?php
    $multi_address = "
    $j = 0;
    while($j < $i){ // $i = number of records
    echo $address[$j]."|". ;
    $j++;
    }
    ";
    ?>

    Of course it does not work, but I'm sure you get what I'm attempting.

    My goal is to retrieve several addresses into a string and use that string in a google maps api.

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  3. #3
    Join Date
    Apr 2003
    Posts
    137
    YAAY!! **dances around**

    thx charles, worked perfectly.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles