Jump to content

adding reviews


foozago

Recommended Posts

how do i make a mysql table variable for comments, so when poeple add their comments it shows up.......right now i can only have one comment per item and no one can add to it....

 

i am trying to make a review site where people can add items and review them and read other people's reviews as well...but i would like it all dynamically so i dnt' have to go in there and add review after review.

 

 

 

Link to comment
Share on other sites

Have you ever written a form that inserts data into a database?  The reason I ask is because once you write one you've sort of written them all, so it sounds like you've never done it before.

 

In which case the best thing to do would be to look for an online tutorial on how to generate an HTML form and insert the user's submission into a database.

 

After that, find a tutorial that shows you how to pull data from the database and display it.

 

Once you can do both of those things, creating a script where users can click on a 'Reply' or 'Comment' link should be trivial.

Link to comment
Share on other sites

hi have made those forms and have created a login form and become a member form...so that works.....but not sure how to create it so the specific reviews come up with the page and how the reviews can be seperated by rows....wont' it look like the review is from the same person?  i need some kind of distinction

Link to comment
Share on other sites

Well, how you separate them depends on your HTML and CSS.

 

For example, the following will draw dashed lines around the li tags of a ul with a class of reviews:

  <style type="text/css">
    ul.reviews li {
      border: dashed black 1px;
    }
  </style>

 

The HTML you generate would then be:

<ul class="reviews">
  <li>This product sucks!</li>
  <li>I love this item!</li>
</ul>

 

As far as database goes, let's assume you're attaching reviews to items.

 

You need an items table with a couple of fields:

items: id, name

 

Then you need a reviews table with a couple of fields:

reviews: id, item_id, review

 

If you wanted to see reviews for a specific item, you'd set up a link that has the item_id as part of the url:

reviews.php?item_id=5

 

On reviews.php, you'd have some sort of code like:

  $item_id = $_GET['item_id'];
  $sql = "SELECT * FROM `reviews` WHERE `item_id`={$item_id}";
  $q = mysql_query($sql) or die('Error: ' . mysql_error());
  echo '<ul class="reviews">';
  while($row = mysql_fetch_assoc($q)){
    echo '<li>' . $row['review'] . '</li>';
  }
  echo '</ul>';

 

Those are the steps in the most basic form.  There's a lot of stuff left out, such as data validation.

Link to comment
Share on other sites

my email is melissa@foozago.com

 

please help...

 

i realize what you said about the select and stuff but it wouldnt' work when i tried doign it that way.., the select thing works the way i have it  maybe it's a cs3 thing?????

 

its at foogazo.com

 

if you type andover in the search bar you can see it wors just by typing select and the rest of the stuff.

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.