Argument is not a function, got undefined

2

I have an error because I have changed my controller I have the same problem.

var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
    $http.get("dashLot.php")
        .then(function (response) {$scope.lots = response.data.records;});
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div class="page-content" ng-controller="customersCtrl">
   <table class="table table-striped">
     <thead>
       <tr>
         <th>Nombre</th>
         <th>Apellido</th>
         <th>Otro</th>
       </tr>
     </thead>
     <tbody>
       <tr ng-repeat="lot in lots">
         <td>{{lot.a}}</td>
         <td>{{lot.b}}</td>
         <td>{{lot.c}}</td>
         
       </tr>
     </tbody>
  </table>

Now if you look closely, this calls a PHP which I want to return all the data that is in the database.

$db = new ezSQL_mysql(DB_USERNAME, DB_PASSWORD, DB_NAME, DB_HOST);
try {
    $result = $db->get_results("select * from tblbilllandingtmp;");

    if ($result->num_rows == 1) {
        sleep(2);
        echo json_encode([
            'success' => true,
            'result' => $result
        ]);

    } else {

        echo json_encode([
            'success' => error]);
        throw new Exception($strRes);
    }
}catch(Exception $ex){

    die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());

}
return $result;

If you could help me, I'd appreciate it

    
asked by Felipe Ahumada Araya 06.01.2016 в 16:04
source

1 answer

-1

Try to change

return $result;

By

echo json_encode($result);
    
answered by 07.01.2016 в 00:26