Jump to content


Photo

help needed with a rating system


  • Please log in to reply
1 reply to this topic

#1 jonsimmonds

jonsimmonds
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 10 May 2006 - 03:45 PM

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

#2 Buyocat

Buyocat
  • Members
  • PipPipPip
  • Advanced Member
  • 267 posts

Posted 10 May 2006 - 07:20 PM

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.
Looking for some easy-to-use tools?  Try these, https://sourceforge....jects/utils-php -- I made them myself.  They're distinct tools which are easy to understand and use.  See some examples uses at http://www.anotherearlymorning.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users