jonsimmonds Posted May 10, 2006 Share Posted May 10, 2006 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 ratingHere is what infomation is passed from the form to the php :// Get Values$comment$detailed $type$rating$ratedid$ratedusername $adid $raterid $dateline$ratedusernameNow 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 joyAny 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 Quote Link to comment Share on other sites More sharing options...
Buyocat Posted May 10, 2006 Share Posted May 10, 2006 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. 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.