I have this 2D Gravity thing I released on my page. The way of calculating the velocity and stuff was really interesting, because the first time in my life I learned Physics beyond school.
Here is the math thing I made for later use.
The first line calculates the distance of both planets. On the second one I gather the acceleration by solving F = ma by using the mass of the primary planet. Now r is calculated as the angle of the primary planet towards the secondary planet. Finally the speed vector ist computed.
In the brackets you can see the actual vector. The x-velocity is the negative cosinus of the angle and the y-velocity is the sinus of the angle. Depends on the coordinate system. m/s^-3 means time, in this case m was actually the size of a pixel and s^-3 was the Delta Time divided by 1000. We multiply that with the vector and with the acceleration. Now we should be ready to update the planet. Do this with every planet with each other planet every frame.