I'm working on a simple advertisement script, I have a database with all the ads and a weight.
The ad is a picture and the weight is a number from 1 to 20 depending on it's importance (1 shows up rarely and 20 shows up a lot.
But if I'm getting this information from my database how do I sort and choose an ad to display? So can I put a weight on a variabele in a creative way? It's possible to make and array for each weight point and then select a random ad from that array but is there a better alternative?