I'm working on a banner manager. The banner table has the following fields:
image
link
views
clicks
weight
I want to display the banner that has the least number of views.
$q = "select * from banners order by views asc"
However, if a particular banner has more weight, it should display more often. For example, a banner with a weight of 10 would display 10x more often than a banner with a weight of 1. Therefore, when calculating views, I need to order by views/weight.
How do I order by a calculation of: views / weight ?