title: Error in controller and can not send data form to mysql with php api
body: <p>I want to insert data from 2 forms to my database using the PHP API. But I got an error. Please help me to fix this.</p>
  
  <p><strong>My form : testing_form.html</strong></p>
  
  <pre><code>&lt;ion-view view-title="Form Insert"&gt;
  &lt;ion-content&gt;
      &lt;div class="list"&gt;
          &lt;div ng-app="myApp" ng-controller="cobaInsert" &gt;
            &lt;label class="item item-input"&gt;
              &lt;input type="text" placeholder="Username" ng-model="username"&gt;
            &lt;/label&gt;
            &lt;label class="item item-input"&gt;
              &lt;input type="password" placeholder="Password" ng-model="password"&gt;
            &lt;/label&gt;
            &lt;button class="button button-block button-positive" ng-click="insertData()"&gt;
                Submit
              &lt;/button&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/ion-content&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>my controller : controller.js</strong></p>
  
  <pre><code>angular.module('myApp',[]);
  .controller('cobaInsert',function($scope, $stateParams, $http){    
          $scope.insertData=function(){      
              $http.post('http://pvcmate.com/api/coba_form.php', {
                  'username':$scope.username,
                  'password':$scope.password
              }).then(function(response){
                      console.log("Data Inserted Successfully");
                  },function(error){
                      alert("Sorry! Data Couldn't be inserted!");
                      console.error(error);
                  });
              }
          });
  </code></pre>
  
  <p><strong>This is my php file : coba_form.php</strong></p>
  
  <pre><code>&lt;?php 
  $data = json_decode(file_get_contents("php://input"));
  // $bname = mysql_real_escape_string($data-&gt;bname);
  // $bauthor = mysql_real_escape_string($data-&gt;bphone);
  
  $username = $data-&gt;username;
  $password = $data-&gt;password;
  
  
  mysql_connect("localhost", "root", "password"); 
  mysql_select_db("testing");
  
  mysql_query("INSERT INTO 'coba_form'('','username','password')
      VALUES ('".$username."','".$password."') ") or die(mysql_error());
  //echo $bname." ".$bphone;
  ?&gt;
  </code></pre>