XF 2.0 Pass data to widget

Hey, I have created a widget in my sidebar and I would like to display information from a table in the same database that my XenForo is using.

I have some PHP knowledge, but I'm very unfamiliar with the XenForo syntax and callbacks etc.

How would I fetch data and display it in my widget?