Fixed database calls

They were broken because I had never used mysqli before and stupidly
assumed that it'd just be the same as mysql calls. Doi...