Jump to content

Specifically Ranking Words


jbonnett

Recommended Posts

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);
}

Link to comment
Share on other sites

  • 3 weeks later...

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 weeks later...
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.