Huge Leap!! Interaction between app and db is setup!

fix app side bug in JSON parsing and server side bug in mysqli syntax.
as part of former commit