Jump to content

help needed with a rating system


jonsimmonds

Recommended Posts

I am working on a classifieds script which I have brought and adapting to my needs, from which I have done alot of!

One thing that I can not fix on it is to run a check to see if a advert has allready recieved a feedback rating

Here is what infomation is passed from the form to the php :
// Get Values
$comment
$detailed
$type
$rating
$ratedid
$ratedusername
$adid
$raterid
$dateline
$ratedusername

Now each advert has a id ($adid) and at most it should have 2 feedbacks linked to it, for both the buyer and seller.

Since the buyer and seller will have different ratedid (or raterid)'s I need to constuct a mysql querie that will check the database to see if there is allready feedback listed for the adid and if so if its for either the buyer or seller, if it is then i can then spit out a error message (database is trading.ratings colums are the same as the entries the form spits out)

My problem is I have zero mysql knowledge and ive tried messing around with some other quieries in the script but to no joy

Any help is very welcome, or a point in the right direction, most of the google searchs I did came up wiht 1 to 5 style rating systems etc
Link to comment
Share on other sites

Let's see, you have the unique ID for the ad and you want to know whether it has the row has a value in the buyer unique ID field and the seller unique ID field? If that's the case then a query like this would find out:
*note I'm putting my own variables in <> switch them with the things you want*
SELECT '<buyer id>', '<seller id>' FROM <tablename> WHERE <ad id> = '<specific ad id>'
if you only want to know that there are things there then you can count the returns, if you want the actual content then you can dump the returns into a recepticle. Hope that helps, Buyo.
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.