AngularJS,ionic和PHP Undefined属性:stdClass

时间:2016-08-21 21:26:22

标签: javascript php html angularjs

我将变量插入数据库,所有值都插入到一个字段(pic)的字段中。我收到此错误

<b>Notice</b>:  Undefined property: stdClass::$pic in <b>C:\xampp\htdocs\work\app_ion\templates\index_files\addphoto_insert.php</b> on line <b>5</b><br />

JS

.controller("camera_controller",['$scope','$http','$cordovaCamera','$ionicLoading','$ionicPopup','$timeout','$location', function ($scope,$http,$cordovaCamera,$ionicLoading,$ionicPopup,$timeout,$location) {
    $scope.email=localStorage.getItem("email");
    $http.get('http://localhost/work/app_ion/templates/index_files/addphoto_grab.php?email='+$scope.email).success(function(data){
        console.log(JSON.stringify(data));
        $scope.grab=data;
        });
        $http.post("http://localhost/work/app_ion/templates/index_files/addphoto_insert.php",
        {'pic':$scope.pic,'email':$scope.item.email,'user_id':$scope.item.profile_id,'country':$scope.item.country,'fpage':$scope.item.fpage})
        .success(function(data,status,headers,config){
        console.log(data)

            });

HTML

 <div ng-controller="camera_controller" ng-repeat="item in grab">
        <form id="form1" name="form1" method="post">
       <input name="user_id" type="hidden" id="user_id" ng-model="item.profile_id" />
              <input name="country" type="hidden" id="country" ng-model="item.country" />
              <input name="fpage" type="hidden" id="fpage" ng-model="item.fpage" />
              <input name="pic" type="hidden" id="pic" ng-model="item.pic" />
              <input name="email" type="hidden" id="email" ng-model="item.email"  />

        </form>
        </div>

PHP

    <?php require_once('../../../Connections/work.php'); ?>
    <?php
    $data= json_decode(file_get_contents("php://input"));

    $pic= mysql_real_escape_string($data->pic);
    $email= mysql_real_escape_string($data->email);
    $user_id= mysql_real_escape_string($data->user_id);
    $country= mysql_real_escape_string($data->country);
    $fpage= mysql_real_escape_string($data->fpage);


mysql_query("INSERT INTO work.pp_change (`pic`,`email`,`user_id`,`country`,`fpage`)VALUES('".$pic."','".$email."','".$user_id."','".$country."','".$fpage."')");
    ?>

有关此错误的任何帮助吗?

0 个答案:

没有答案