Ask about general coding issues or problems here.
2 posts • Page 1 of 1
it's all about how you implement your rating system. personally, i'd have a ratings table, with the fields : id,user_id,product_id,and rating. Then you can have a stored procedure that updates or inserts based on the combination of user_id, and product_id. I'd have it so that when a user accessed a product page where they could rate, the current overall rating and their personal rating are stored in variables and displayed, and then if they make a change, or resubmit, you will know because isset($userRating) will have been populated by an existing value.
The only thing that changes is that you don't need the rating field. When they load the page, query the database to see if they've already submitted, if yes, indicate which they've voted for. Then checking if the the variable that stores their existing vote isset() lets you know if you need to insert or update if they vote again.
Who is online
Users browsing this forum: No registered users and 3 guests