Help? Design for Restaurant Descript with Comment and Rating

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
illiquid050
Forum Newbie
Posts: 4
Joined: Wed Jul 30, 2003 1:44 pm

Help? Design for Restaurant Descript with Comment and Rating

Post by illiquid050 »

:!: Total newbie question but I figure a little help with design and planning can save me hours later on.

I'm about to try to make a site that lists all the local campus eateries around the school here. I want users to be able to leave a comment as well as a 1-5 rating.

I envision a main page
Restaurant Name | Restaurant Phone | Rating
Clicking on a restaurant will display Restaurant Name and Averaged Rating some other info (delivery hours, phone, address, etc.) followed by user comments (with individual rating) and a form for comment and rating.
Restaurant Name Rating
Restaruant Phone
Restaurant Address

Comments:
[comment1] [comment1rating]
[comment2] [comment2rating]

etc.
I realize I have to use multiple tables. But the set up is tricky. I probably need one table for the restaurant info, a second for the comments and a third for the ranking?

I was hoping to cheat by using a 5star ratings script i picked up and somehow combining it with a comment script from hotscripts.com but now I'm thinking it might be more efficient to go from scratch (borrowing from other scripts as needed). Any advice/pointers/ideas would be super super helpful.

Many thanks in advance.
jmarcv
Forum Contributor
Posts: 131
Joined: Tue Jul 29, 2003 7:17 pm
Location: Colorado

Post by jmarcv »

actually, seems to me the ranking would be related to the comment directly, so they can go in the same table, no? If no comment, just use rating. If no rating, just use comment. Though I would probably make them both required.
illiquid050
Forum Newbie
Posts: 4
Joined: Wed Jul 30, 2003 1:44 pm

thanks

Post by illiquid050 »

true. that's a great idea. the ranking seems easy enough to implement but as far as 'comments' go, is it worth just modifying an existing script or starting from scratch. If i start from scratch I have to worry about creating some kind of processing code that disallows HTML etc.

Any recommendations on that?
jmarcv
Forum Contributor
Posts: 131
Joined: Tue Jul 29, 2003 7:17 pm
Location: Colorado

Post by jmarcv »

I usually spend more time analyzing and modifying a script then doing it from scratch. Thats me.
In any event, dissallowing html is pretty minor. one strip_tags() and they be gone!

Other useful commands for comments type data:
htmlentities
ln2br
Post Reply