jbonnett Posted March 29, 2012 Share Posted March 29, 2012 Can anyone help me im trying to set a quality rank order being from highest to lowest. blu-ray, dvd, ts, cam, and then x if there are no links. By doing this each link has a quality column (each link has a quality attached) and then in a different table i have an overall quality that is set by the highest link quality. Another words i would like to check all links for the highest quality and insert the highest quality in another table. Im sorry if you dont understand cant think of a better way of explaining. Heres something i made when adding links, it finds the link quality and then the overall quality and compares them only it does not search all links and does not lower the overall quality. $result = mysql_query("SELECT quality FROM videoa WHERE id=$_REQUEST[id]"); while($row = mysql_fetch_array($result)) { $rowqual = $row['quality']; } mysql_close($con); if ($_POST['quality'] == "blu-ray"){ $rank = 4; }elseif($_POST['quality'] == "dvd"){ $rank = 3; }elseif($_POST['quality'] == "ts"){ $rank = 2; }elseif($_POST['quality'] == "cam"){ $rank = 1; }elseif($_POST['quality'] == "x"){ $rank = 0; } if ($rowqual == "blu-ray"){ $rank1 = 4; }elseif($rowqual == "dvd"){ $rank1 = 3; }elseif($rowqual == "ts"){ $rank1 = 2; }elseif($rowqual == "cam"){ $rank1 = 1; }elseif($rowqual == "x"){ $rank1 = 0; } if ($rank1 < $rank){ $sql= " UPDATE `videoa` SET quality='$_POST[quality]' WHERE id='$_REQUEST[id]' "; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Quality Added"; mysql_close($con); } Quote Link to comment Share on other sites More sharing options...
fenway Posted March 31, 2012 Share Posted March 31, 2012 I don't follow. Quote Link to comment Share on other sites More sharing options...
jbonnett Posted April 15, 2012 Author Share Posted April 15, 2012 Say I have film in a database e.g. "Captain America" while the film has no links the quality in the database will be X, if I add a link to the database with the quality "DVD" I want it to update "Captain America" quality "DVD", the link quality and the film quality are separate quality's as in the film quality is determined by the highest link quality. So if a link is the highest quality and is deleted the film quality will be downgraded. Cheers, Jamie. Quote Link to comment Share on other sites More sharing options...
fenway Posted April 15, 2012 Share Posted April 15, 2012 Sounds like you're linking some score to some other relationships. Quote Link to comment Share on other sites More sharing options...
jbonnett Posted April 15, 2012 Author Share Posted April 15, 2012 Well I don't know how to go about it I tried "the code in first post" and only works for going up in quality when adding links, not down. Any ideas? Quote Link to comment Share on other sites More sharing options...
fenway Posted April 21, 2012 Share Posted April 21, 2012 Can you give some concrete examples -- no code? Quote Link to comment Share on other sites More sharing options...
jbonnett Posted April 21, 2012 Author Share Posted April 21, 2012 What do you mean? Quote Link to comment Share on other sites More sharing options...
fenway Posted April 22, 2012 Share Posted April 22, 2012 I mean, you say it works for up, not down. Give me an example of input & output for both cases, in English. Quote Link to comment Share on other sites More sharing options...
jbonnett Posted April 23, 2012 Author Share Posted April 23, 2012 Lets say the film "Captain America" already exists if I add a link with the quality "DVD" the main film quality goes up to "DVD" if I add another with the quality "BLU-RAY" the film quality goes up to "BLU-RAY" but if I delete "BLU-RAY" the main quality stays at "BLU-RAY" I want that to change down to "DVD" again and so on with any other link quality's. Quote Link to comment Share on other sites More sharing options...
fenway Posted May 12, 2012 Share Posted May 12, 2012 I don't understand why you just don't change the field -- you want it to be DVD and BLU-RAY? 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.