Sorry if I don't make this too clear, what I'm doing is creating a text based adventure game in PHP, a lot like Colossal Cave.
I do not want to recreate my databases for every user so I hoping to write all the user date into a file and read variables from it when I require.
For example the file would be like this:

HP: 100
Room: 4
Item: torch
Item: batteries


I know a tiny bit about fopen, fseek and fwrite but I do not know how I would go about extracting the text as variables into PHP and writing them back in.

Any help would be gratefully recieved

8 Years
Discussion Span
Last Post by daryll1

Sorry I cant show my code as all I have at the moment is my databases, it works for a single user and I see this way most fit to implement multi-user into the game.

In your opinion would it be a better option to use the flat file and draw the variables from that when needed or write a script to create a new database and tables for each user?

I thought about using a database to store the information but for a single user it requires 6 tables in the database to fully normalise it, therefore I did not think it would practical to do this for the user base I intend to test on in the Uni.

Kireol thank you for that, I will look into those options for now.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.