Arrays in database

Discussion in 'PHP' started by Kennedy, Aug 30, 2007.

  1. #1
    I'm looking to do something simple, but having a problem with not even knowing where to start.

    I want to have an array stored in a database. The php file accesses the first string in the array, deletes it, then adds a new string at the end of the array.

    Is this possible?

    Thanks in advance.
     
    Kennedy, Aug 30, 2007 IP
  2. xemiterx

    xemiterx Peon

    Messages:
    62
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    xemiterx, Aug 30, 2007 IP
  3. Kennedy

    Kennedy Peon

    Messages:
    994
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you very much for the help!

    Do you think it'd be easier if I just used a flat file system? I considered using a text file, but it might get up to 200 lines long or so. Would that bog down the server too much or do you think it'd be okay? Also, would there be any problems with a flat file system if multiple people loaded up the page?
     
    Kennedy, Aug 30, 2007 IP
  4. ssanders82

    ssanders82 Peon

    Messages:
    77
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Not particularly, you'd have to serialize to file instead of serializing to database.

    Not if they're just reading the file and not editing it. When you say "The php file accesses the first string in the array, deletes it, then adds a new string at the end of the array", do you mean that happens everytime someone looks at the php page? In that case a flat file system wouldn't be good without some sort of code to handle multiple opens at once.

    Can you provide a little more info?
     
    ssanders82, Aug 31, 2007 IP
  5. Kennedy

    Kennedy Peon

    Messages:
    994
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Basically I want the user to "trade" in a string.

    1. The page will give them a string from the array.
    2. They "take" the string (click it) which causes it to delete itself.
    3. They supply a new string that goes into the array.
     
    Kennedy, Aug 31, 2007 IP
  6. Kennedy

    Kennedy Peon

    Messages:
    994
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Just an added note, it doesn't even have to be an array. I just need some kind of method for someone deleting a string "in line" then adding their own to the end of the "line".
     
    Kennedy, Aug 31, 2007 IP