tcollie Posted January 3, 2007 Share Posted January 3, 2007 Okay, here's the problem that I'm having. I have information stored in a database, but I want to be able to store this information in a file instead of having to call it from the database to save on database traffic. I think what I need is an array for my data, but I'm not sure. Here is the database structure:[i]tbl_city[/i]city_idcity_name[i]tbl_location[/i]location_idcity_idlocation_namepostive_ratingsnegative_ratingsSample Data would be like this:[i]City[/i]: New York (city_id#1)[i]Locations[/i]:[b]Central Park[/b] (location_id #1)Positive Ratings: 5Negative Ratings: 1[b]Ellis Island[/b] (location_id #2)Positive Ratings: 7Negative Ratings: 0The structure of the file I would like to create would be something like this (I think):[b]city id/city name[/b]Location 1Positve Rating (Location 1)Negative Rating (Location 1)Location 2Positve Rating (Location 2)Negative Rating (Location 2)etc.Can somebody help me with this. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted January 3, 2007 Share Posted January 3, 2007 In the PHP manual, look up the following:fopenfwritefile_get_contentsimplodeexplodeMore importantly, why would you not want to store this in a database? Quote Link to comment Share on other sites More sharing options...
tcollie Posted January 3, 2007 Author Share Posted January 3, 2007 I ended up just writing some switch statements and separate files to achieve what I wanted. As for not wanting it stored in the db, I'm anticipating very high traffic to the db and just want to cut down on unnecessary calls to the db. I don't mind a separate call to the files in question, I'm just really trying to speed up the database functions. 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.