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
https://forums.phpfreaks.com/topic/92195-adding-reviews/
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
https://forums.phpfreaks.com/topic/92195-adding-reviews/#findComment-472284
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
https://forums.phpfreaks.com/topic/92195-adding-reviews/#findComment-472293
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
https://forums.phpfreaks.com/topic/92195-adding-reviews/#findComment-472318
Share on other sites

my email is [email protected]

 

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
https://forums.phpfreaks.com/topic/92195-adding-reviews/#findComment-472326
Share on other sites

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.