Pages redirect to themselves, sql changes

queries.php was not working right, fixed an issue with getPinLinks and
the other queries not returning the same order.

many of the edit functions now redirect to their own page
SQL queries update didn't stick from last commit