Results 1 to 3 of 3

 

Thread: String Array

  1. #1
    Chris Clarkson's Avatar
    PHP never lies...

    Status
    Offline
    Join Date
    Jul 2003
    Location
    Glasgow
    Posts
    670
    Thanks
    7
    Thanked 22 Times in 10 Posts


    Hi,
    Using a form I'm try to update 3 variables, all of which are arrays.
    $var1 and $var2 are checkbox results and no problem, but $var3 is a text input, and I'm having trouble updating results.
    eg. $var3 = text:more text:even more text:

    I can create a db entry, using

    PHP Code:
        $result sql_query("insert into ".$prefix."_blah values ('$id', '$var1', '$var2', '$var3')"$dbi); 
    but can't update. Even tried Delete from and recreate entry, but still not working. I think the solution is to pass it ($var3) as a normal variable and not an array.

    Sorry if this makes no sense, but any help appreciated!

    Chris

  2. #2
    thin[box]king

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Cambridge
    Posts
    1,905
    Thanks
    13
    Thanked 12 Times in 12 Posts
    Hi
    to turn var3 from an array into a string (assuming you are using PHP)
    use implode()
    implode ( string glue, array pieces)


    ie if your array $arr contains 3 elements a, b, c

    $text_string= implode(", ", $arr);

    $text_string will then = "a, b, c"
    Follow Me | Looking for Merchants Who Do Scifi Stuff

  3. #3
    Chris Clarkson's Avatar
    PHP never lies...

    Status
    Offline
    Join Date
    Jul 2003
    Location
    Glasgow
    Posts
    670
    Thanks
    7
    Thanked 22 Times in 10 Posts
    Thanks scifind,
    funny when I asked the question I wondered if the answer might be blindingly obvious!

    Thanks very much, ended 4 days of hair pulling (not much there to begin with).

    Cheers

    Chris



Thread Information

Users Browsing this Thread

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

Similar Threads

  1. php: find string length
    By morleymouse in forum Programming
    Replies: 2
    Last Post: 25-06-04, 11:47 AM
  2. How long is a piece of string?
    By smn2 in forum Affiliate Marketing Lounge
    Replies: 4
    Last Post: 10-05-04, 09:22 AM
  3. Exploding array vars to give hash table
    By scifind in forum Programming
    Replies: 0
    Last Post: 06-05-04, 03:37 PM
  4. how to shorten a string (php)
    By morleymouse in forum Programming
    Replies: 3
    Last Post: 27-03-04, 04:35 PM
  5. Removing forward slashes / from a string in PHP
    By giveasyouget in forum Programming
    Replies: 6
    Last Post: 19-09-03, 11:06 PM

Bookmarks

Posting Permissions

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

Content Relevant URLs by vBSEO 3.5.0 RC2