Completely switched to the PDO instead of mysqli... 

Lots of changes made, removed all the mysqli things, simplified the code, adjusted some lines to be more beautiful and readable