javascript - Inserting JSON object into MySQL table with Angular/PHP -
so have json object want insert field in mysql table. when "console.log(thatjson)", prints json object in console text [object], information available when click on object. however, when "alert(thatjson)" prints "object object" in alert box, , when check table in phpmyadmin, field varchar(2000) stored string says [object object].
in php, have $property = json_decode($request->getbody()); decode angular passed json data, apparently did not help. : (
any ideas?
edit:
relevant code:
$scope.update = function(thatjson){ $http.put('api/envisiondb/0', thatjson).success(function(data) { $scope.properties = data; }); };
php slim:
function editproperty($id) { $request = slim::getinstance()->request(); $property = json_decode($request->getbody()); $sql = "update db set username=:username..."
the json object regular everyday json object
make sure pass request data through json.stringify()
function.
Comments
Post a Comment