So here's what happened
I was happily using my Macbook as usual, and I closed the lid like I always do when I put it away.
When I came back and wanted to use it again two hours later, I open it up and type in my password. Strangely I'm greeted with the infamous spinning beach ball of death, and after a minute or two of the computer not responding I close the lid again.
I then hear the boot sound, and thinking the computer simply crashed and rebooted I open the lid, only to see the flashing question mark folder.
Doing some research I find that it means the computer can't find the boot drive, so I reboot into Internet recovery mode, and try to select the boot drive... Nothing's there. I then go to Disk Utility to try and see if I can repair the drive. All I find is the base system, to which I don't have write permissions, and as such am not allowed to repair or format.
What do I do? I don't want to lose all the precious work I have on it, and I don't have a time machine for backups.
It's a late 2011 13 inch Macbook pro with 8 gb ram and a 2 tb hard drive
New Information:
The computer boots fine from the hard drive if I connect it via USB, so I suspect it might have something to do with the cable, but I'm not sure.