invisionx Posted June 26, 2007 Share Posted June 26, 2007 I know this is a total noob question but im just getting into flat file scripts because a friend of mine has a site that does not have a database. so i told him ill try making him a news script made with flatfile so he doesn't have to switch hosts.. but my question is.. is there a way to delete data thats in flatfile? like set them in an array or something? please help me thank you invisionx Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted June 26, 2007 Share Posted June 26, 2007 The trick to flat filing is using delimters to seperate data in the flat file most common method is each new "fake mysql row" is delimitered by a \n (break line) and each field is seperated by a comma or semi colon, what ever delimtier works best in your case (it can't be used in the values). Yes you can append it very easily if you set it up like this but you have to open the flat file find the row you wanna append append it then resave the file. Quote Link to comment Share on other sites More sharing options...
invisionx Posted June 26, 2007 Author Share Posted June 26, 2007 well im getting alittle what your talking about like the break and stuff fputs ($out,implode,("\n")); see the part i am not understanding is append part. ??? are you talking about going into cpanel and deleting it? because he doesn't really want to keep going in there to delete it all the time. and also im not sure if im doing this right im saving the files from form as tables so it would be inside of tables which work great but not sure if there is a different way.. and i read the file like readfile("users/data.dat"); Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted June 26, 2007 Share Posted June 26, 2007 read up on php.net about fopen. To append the file you need to open it in php then explode on the \n then pick which row you want and set it to what you want them simply rewrite the whole file with the exploded array 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.