foozago Posted February 20, 2008 Share Posted February 20, 2008 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. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted February 20, 2008 Share Posted February 20, 2008 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. Quote Link to comment Share on other sites More sharing options...
foozago Posted February 20, 2008 Author Share Posted February 20, 2008 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 Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted February 20, 2008 Share Posted February 20, 2008 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. Quote Link to comment Share on other sites More sharing options...
foozago Posted February 21, 2008 Author Share Posted February 21, 2008 hi.....obviously this is over my head...do you build sites? and if so would you be interested in buildlign this one for me Quote Link to comment Share on other sites More sharing options...
foozago Posted February 21, 2008 Author Share Posted February 21, 2008 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. Quote Link to comment Share on other sites More sharing options...
foozago Posted February 21, 2008 Author Share Posted February 21, 2008 okay yeah its foozago.com NOT foogazo.com.......that's how frustrated i am Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.