Hey guys. I have a small problem. I have a PHP-file on my homepage. That PHP consists of several items (called "tool"), each with their own priority (called "quantity") to get selected, and their own weight (called "amount"). The script selects 1 "random"(?) item (some items have a higher chance of getting selected than others), and then it checks to see if the current weight is between minimum and maximum weight. If it is below minimum weight, it takes a new item, and checks if those two items is now between minimum and maximum weight. If it is, it stops the script and displays the result. If it is not, it takes a new item and checks again. And so on.
I have moved my database-array with all the items, and their weight and priorities to a MySQL database. But I can't get the script to work again. It is line 31 to 43 on the new PHP file, that it not working correctly, I think.
Please, could someone take a look at it, and tell me what I am doing wrong?
Everything was working perfectly before on my old script, but I wanted to move to a MySQL database so people, that have signed on on my homepage, will be able to change their own list of items further down the road.
The OLD script I was using is here in this code-snippet. That was working perfectly.
It is line 19 to 28 you would look at here, I think!