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 3 of 3
  1. #1
    Senior Coder o0O0o.o0O0o's Avatar
    Join Date
    Jan 2008
    Location
    C:\Windows\System32
    Posts
    1,018
    Thanks
    19
    Thanked 9 Times in 9 Posts

    php array question

    hi ,

    I am getting the array like this in php page


    Code:
    $arr = "menu[]=2&menu[]=4&menu[]=8"
    Now i want to store it in database

    How can i convert that array to


    Code:
    menu[0] = 2
    menu[1] = 4
    menu[2] = 8

    so that i can store in database
    Last edited by o0O0o.o0O0o; 06-01-2009 at 06:07 AM.
    Please de-reputate me
    © 0o0o0o0

    Its better to rule in Hell then to serve in Heaven

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Do you mean that $menu should exist as an array?
    PHP Code:
    $menu = array();
    parse_str($arr); 
    Done and done. That provides you with the $menu array, but I'm not 100% certain thats what you're looking to do.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Senior Coder o0O0o.o0O0o's Avatar
    Join Date
    Jan 2008
    Location
    C:\Windows\System32
    Posts
    1,018
    Thanks
    19
    Thanked 9 Times in 9 Posts
    thanks for that ,

    Actually there was error in posting.
    I was storing all the arrays in one variable and then posting that variable but
    actually i needed to post all the arrays at once

    Thats why i was not receiving them properly
    Please de-reputate me
    © 0o0o0o0

    Its better to rule in Hell then to serve in Heaven


  •  

    Posting Permissions

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