Announcement

Collapse
No announcement yet.

Storing Arrays?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Storing Arrays?

    Hi Guys,

    To this point in my Miva scripting experience, I've only ever used arrays to perform simple tasks. And for that matter I've just copied examples from others.

    So now I'm trying come up to speed on array programming in Mivascript and would like to know if/how an array can be stored in a xBase file?

    Also, I've seen some example code using <MVT:> However, I could not find anything in the online docs at mivascript.com
    Should I look into that tag, or is that something unique to merchant?

    Thanks,
    Tim

    #2
    Re: Storing Arrays?

    See this page on how to interact with XBase databases using MivaScript

    http://www.mivascript.com/topic/xbase3.html


    However, you'll want to use the miva_array_serialize function which will take your array you have in MivaScript and create a name value pair string which can be written to a database field.

    http://www.mivascript.com/item/mivas...serialize.html

    When you're ready to read that value back in, you can deserialize it and restore it back to an array using miva_array_deserialize

    http://www.mivascript.com/item/array...serialize.html


    Code:
    <MvASSIGN NAME = "l.array_serialized" VALUE = "{ miva_array_serialize( l.array ) }">
    
    // Write l.array_serialized to the database
    Last edited by Brennan; 07-22-14, 06:24 AM.
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      Re: Storing Arrays?

      Thanks Brennan!

      Comment


        #4
        Re: Storing Arrays?

        Although, if you have the option, using MySQL will be happier in the long run...(at least it is for me) :)
        Bruce Golub
        Phosphor Media - "Your Success is our Business"

        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
        phosphormedia.com

        Comment

        Working...
        X