Jump to content

[SOLVED] Need help with an array, I think


tcollie

Recommended Posts

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_id
city_name

[i]tbl_location[/i]
location_id
city_id
location_name
postive_ratings
negative_ratings

Sample 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: 5
Negative Ratings: 1
[b]Ellis Island[/b] (location_id #2)
Positive Ratings: 7
Negative Ratings: 0

The structure of the file I would like to create would be something like this (I think):

[b]city id/city name[/b]
Location 1
Positve Rating (Location 1)
Negative Rating (Location 1)
Location 2
Positve Rating (Location 2)
Negative Rating (Location 2)
etc.

Can somebody help me with this.
Link to comment
https://forums.phpfreaks.com/topic/32661-solved-need-help-with-an-array-i-think/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.