You can do that on the IPN page. Just log into the merchant paypal account and turn on IPN and specify the IPN page url. Then paypal will post to that page whenever an item is sold and you can insert a record into the database based on the posted values.
This is something we can help with in a premier support ticket.