Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: array to string

  1. #1
    New Coder
    Join Date
    Mar 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    array to string

    I current have an array called $hole[].

    the code is as follows:

    PHP Code:
    $x=1;
    $round_detail_string "";
        foreach (
    $hole as $value){
            
    $round_detail_string += '(null,"'.$x.'","'.$value.'"),';
        } 
    any ideas why this isnt adding the string to the string after it?

    I am trying to create one long insert statement based on the values in the array.

    Any suggestions?

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    PHP Code:
    $round_detail_string .= '(null,"'.$x.'","'.$value.'"),'
    It's a dot (.) to concentate (sp) strings, not a +

  • #3
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try

    PHP Code:
    $round_detail_string .= '(null,"'.$x.'","'.$value.'"),'
    PHP Code:
    .= 

  • #4
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    damn...nearly made it in time


  •  

    Posting Permissions

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