Jam87 Posted March 20, 2007 Share Posted March 20, 2007 Hi, I've recently been trying to build a user specific phone book using flat file databases. Basically I want php to create a flat file that is unique, and only accessible by that particular user. So when the file is created for example, each database reflects the particular users name, danny.txt for instance. So danny logs onto the site, and browses to the phonebook page, where php loads only his particular flat file database and lets him edit it accordingly. Any help would be much appreciated, I've looked through various tutorials but none seem to indicate how to create user specific databases. Quote Link to comment Share on other sites More sharing options...
per1os Posted March 20, 2007 Share Posted March 20, 2007 Although slow they can be effective. Anyhow you need to look into the fopen, fwrite and fclose via php.net http://us2.php.net/manual/en/function.fopen.php That should help you on your way. Quote Link to comment Share on other sites More sharing options...
tarun Posted March 20, 2007 Share Posted March 20, 2007 Have You Got A Login System Yet? Quote Link to comment Share on other sites More sharing options...
Jam87 Posted March 20, 2007 Author Share Posted March 20, 2007 Yes, i've got a mysql powered user login system, is there a way i can call the users name and use that to create a database with that name? Quote Link to comment Share on other sites More sharing options...
tarun Posted March 20, 2007 Share Posted March 20, 2007 Well If You Could Call The Username In A Variable You Could Do Something Like: include("phonebooks/$username.txt"); Quote Link to comment Share on other sites More sharing options...
interpim Posted March 20, 2007 Share Posted March 20, 2007 $filename=$user . ".txt"; fopen($filename) will create a file if it doesn't exist... if you read up on this stuff http://us3.php.net/fopen you can get a lot more info on how to do this, for example what different methods you can use, and what happens with each different method. Quote Link to comment Share on other sites More sharing options...
per1os Posted March 20, 2007 Share Posted March 20, 2007 Why are you storing the phonebook in a flat file if you have a DB? I would store it in a table on the database, it will work faster than the flatfile. Quote Link to comment Share on other sites More sharing options...
Jam87 Posted March 20, 2007 Author Share Posted March 20, 2007 I'm still getting to grips with php, and have no idea how to seperate each users records so that only he can see them Any help or direction is much appreciated Thanks for all the help so far Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.