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
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.