variable shared by users

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • otiteca

    variable shared by users

    Hi,

    Is there anyway to share a variable between many web users ?

    I've got an array, updated by users's actions.
    i do want this same array be available to all web users in their sessions.

    This without putting the content of the array in DB or file.

    I can not use shmop or sysvsem

    Any idea ?
  • Gordon Burditt

    #2
    Re: variable shared by users

    >Is there anyway to share a variable between many web users ?[color=blue]
    >
    >I've got an array, updated by users's actions.
    >i do want this same array be available to all web users in their sessions.
    >
    >This without putting the content of the array in DB or file.
    >
    >I can not use shmop or sysvsem
    >
    >Any idea ?[/color]

    This is generally what a database is used for. And a database or
    file is about the only way you will get the functionality you want.

    Gordon L. Burditt

    Comment

    • Default User

      #3
      Re: variable shared by users

      otiteca wrote:
      [color=blue]
      > Hi,
      >
      > Is there anyway to share a variable between many web users ?
      >
      > I've got an array, updated by users's actions.
      > i do want this same array be available to all web users in their
      > sessions.
      >
      > This without putting the content of the array in DB or file.[/color]


      Why don't you want to use a DB or file?




      Brian

      Comment

      • JDS

        #4
        Re: variable shared by users

        On Thu, 21 Jul 2005 19:07:57 +0200, otiteca wrote:
        [color=blue]
        > This without putting the content of the array in DB or file.[/color]

        serialize the array and put it in a database or file.

        oops! You don't want to put it in a db or file. well why the hell not?

        --
        JDS | jeffrey@example .invalid
        | http://www.newtnotes.com
        DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

        Comment

        • evanescent.lurker@gmail.com

          #5
          Re: variable shared by users

          > Is there anyway to share a variable between many web users ?[color=blue]
          >
          > I've got an array, updated by users's actions.
          > i do want this same array be available to all web users in their sessions.
          >
          > This without putting the content of the array in DB or file.[/color]

          What you want is a global site variable. I don't think PHP can do
          that...

          That would make it easy to create counters of various types, shout
          boxes, and a lot of other things, but without the overhead of the db,
          or file...

          I guess the DB is your choice for now.

          -- Evanescent Lurker --

          Comment

          • NC

            #6
            Re: variable shared by users

            otiteca wrote:[color=blue]
            >
            > I've got an array, updated by users's actions.
            > i do want this same array be available to all web users in their sessions.
            >
            > This without putting the content of the array in DB or file.
            > I can not use shmop or sysvsem[/color]

            Well, since you are being so restrictive, how about combining the
            two methods? :) Configure a small RAM disk or a HEAP table in MySQL
            and store your stuff in a file on that RAM disk or in a record
            (perhaps the only one) in the HEAP table... No disk spinning will
            be involved; the data will remain in memory and will be shareable
            between as many users as you want...

            Cheers,
            NC

            Comment

            Working...