No announcement yet.

How did Vbulletin do this? [Arrays in sql cells]

  • Filter
  • Time
  • Show
Clear All
new posts

  • How did Vbulletin do this? [Arrays in sql cells]

    Well I noticed this from a table of my vbulletin database, note the column buddylist:

    As far as I know, it is impossible to store an entire array in a single PHP cell, but looks like Vbulletin did it, and it turned out to be pretty nice looking. I wonder how it is possible to pass an array to a single mysql cell like VB did here. I'd appreciate it very much if anyone of you can tell me what trick this is.

    Hall of Famer

  • #2
    We remove the array formatting and store it just as a single spaced list. Then when we pull it back out we format it back into an array


    • #3
      anders | vbulletin team | check out the new vbulletin facebook app
      Proudly vBulletin'ing since 2001
      Please be my friend!
      vBulletin Performance Articles:
      Click here to read


      • #4

        e: Apparently Zak is more awesome than I give him credit for.


        • #5
          I see, so it is all about manipulating the two string-array transformation functions? It looks pretty cool I have to say, thank you so much.

          Still another question though. Are these the correct steps of manipulating explode/implode functions?

          1. Retrieve a string from a mysql cell, defines a variable such as $string to store its value.
          2. Convert this string to an array using explode(), with delimiters such as comma, dot or space,
          3. Call function array_merge() to add a new element(or multiple new elements) to the array.
          4. Actual PHP programming.
          5. convert array back to string using implode() and update mysql query.

          Also is it possible to convert a string to an associative array? Just curious.


          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.