optimised the queries and fixed selling.php

optimised the queries and fixed selling.php