So I am updating the database on my server so that players have to be a certain class to equip certain weapons.
So I am dividing the number of rows in shop where the type is equal to weapon, by the amount of classes in the game; which right now is equal to 7. So now weapons will be split into a certain amount of groups.
Which comes out to (# of weapons in shop) / 7.
Now for the first group of seven(1/7), I want it to update the class requirement to "Fighter"
For the second(2/7), I want it to update the class requirement to "Fighter II"
For the third(3/7), I want it to update the class requirement to "Fighter III"
For the forth(4/7), I want it to update the class requirement to "Fighter IV"
For the five(5/7), I want it to update the class requirement to "Fighter V"
For the six(6/7), I want it to update the class requirement to "Assassin"
For the seven(7/7), I want it to update the class requirement to "Assassin II"
Now the script of course will adjust whenever I add new classes or weapons. But I cannot seem to find anything to for fill the needs I have.
Now this is what I have came up with. I know this is not a working script at all. This is to portray the idea I have.
$getshopwepadj = mysql_query("SELECT * FROM shop WHERE type='Weapon' ORDER BY value");
$shopwep = mysql_num_rows($getshopwepadj);
$getclassadj = mysql_query("SELECT * FROM classes ORDER BY id");
$classrows = mysql_num_rows($getclassadj);
$shopwep = floor($shopwep/$classrows);
$updatewep6 = mysql_query("UPDATE shop SET classreq='Fighter', classlevelreq='1' WHERE ".$shopwep."<=6");//This line will not work I know. This is where I need to figure out how to set this up.