If no connection, mysqli can't return errors... maybe a string then?

Signed-off-by: emanuele <emanuele45@gmail.com>
Mostly moving things around trying to make the two look the same (postgre class)

Signed-off-by: emanuele <emanuele45@gmail.com>
One less query in ProfileAccount

Signed-off-by: emanuele <emanuele45@gmail.com>
Another query out of ProfileAccount.controller and a bit of readability improvement I think

Signed-off-by: emanuele <emanuele45@gmail.com>
And now ProfileAccount.controller is query-free

Signed-off-by: emanuele <emanuele45@gmail.com>
A couple of queries out of ProfileHistory.controller too

Signed-off-by: emanuele <emanuele45@gmail.com>
Merge pull request #1063 from emanuele45/db_rand

An error, some moving around of queries, etc.