Replaced Mysqli with PDO. Structured PHP Backend a bit more.