Justin
Justin

Reputation: 75

A practical way to organize MySQL database info?

I'm wondering what is the best way to do this:

  1. Person submits review (name, email, webhost, domain hosted, ranking data [five numerical factors], etc.)

  2. PHP inserts that review into "SubmittedReviews" table

  3. I then oversee the submitted reviews in the back end, then submit the ones I want

4 . PHP inserts that info into another table called "LiveReviews" (which has the same table structure as "SubmittedReviews")

(OR, might be better to have PHP create a table for each host, with that hosts' reviews inside it, since there will be many hosts and I'm going to make a separate table to pre-calculate ranking data for my "top hosts" table on the site)

So as I have PHP submit the reviews live (creating a new table [for each host] or just into the "LiveReviews" table) I will also submit the ranking data into another table, adding up all the ranking data for each host, so it is readily available and so I know which hosts are ranking highest.

Or should I just use PHP to calculate the LiveReviews ranking data on the spot when I want to know which host is ranking best? Seeing as the front page will be loading this data often, doesn't seem it'd be good to calculate it every time. I'd rather have it calculated beforehand.

So if I have this "ranking data" table, then it seems I should have tables for each host with all their reviews. Otherwise, it seems just having one large table (LiveReviews) is better.

Hope this makes sense!

What is the best way? I'm pretty new to MySQL.

Upvotes: 2

Views: 149

Answers (1)

user1890202
user1890202

Reputation: 50

I must admit that I don't understant exactly what you're trying to achive. What exactly are your users supposed to review?

However I do have two pieces of advice: Never organize stuff by placing it in different tables. It's heresy in the world of relational databases! And your queries will en up uneccesary complicated. And consider doing calculation in the DB, not in PHP.

Learning database modeling is a good idea. Entity-Relationship diagrams are not hard but very useful.

Good luck.

Upvotes: 1

Related Questions