Jump to content

Archived

This topic is now archived and is closed to further replies.

jonsimmonds

help needed with a rating system

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

×

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.