/ Published in: MySQL
This snippet allows you to get random record from given table by weight. To run it, it must have a field named "weight". The more "weight" is assigned, the more often the record is selected. The value of "weight" should be an integer between 1 and 10 (or anything else).
Expand |
Embed | Plain Text
URL: http://www.apphp.com/index.php?snippet=mysql-get-random-record-based-on-weight