Well, I don't know if PHP or MySQL have a built-in way of doing it, but you could do it manually.
If, for example, you have 2 traffic sites, A and B. And you want the weight of A to be 2 and the weight of B to be 1. Therefore, the total weight is 3, and A would have 2/3 and B 1/3.
You also know that PHP's rand() function returns a value from 0 to RAND_MAX. Therefore, by letting 2/3 of the 0 to RAND_MAX range be A, and 1/3 be for B, you can have a weighted random number.
So, for example, if RAND_MAX is 11. Then there are 12 values that rand() can return, 0,1,2,3,4,.., 10, and 11. So, if the first 2/3 belong to A, in other words 0,1,2,3,4,5,6,7. And the last 1/2 goes to B: 8,9,10,11. Then the chances of rand() returning a value for A is double the chances for B, just because the range is double.
Hope that made sense 🙂
Diego