It looks like you're using the mysqli php library to connect to an mssql database. Trying debugging your php script by invoking it directly in the browser.
On Sat, May 26, 2018, 19:29 Andrej Batarilo <andrejbatarilo...@gmail.com> wrote: > *Hello, so I prettty much copied this code and it doesn't work for me, but > does for other people (the entire html and php)* > > *When I try the query in SQL Management it works, so I don't think it's > the database* > *When I try to read from the database it's just blank, no errors in the > console* > > *Here is my select.php:* > > <?php > //select.php > $connect = mysqli_connect("den1.mssql5.gear.host", "testiranje", > "nijebitno@", "testiranje"); > $output = array(); > $query = "SELECT * FROM dbo.tbl_user"; > $result = mysqli_query($connect, $query); > if(mysqli_num_rows($result) > 0) > { > while($row = mysqli_fetch_array($result)) > { > $output[] = $row; > } > echo json_encode($output); > } > ?> > > *Here is my html code:* > > <!DOCTYPE html> > <!-- index.php !--> > <html> > <head> > <title>Webslesson Tutorial | AngularJS Tutorial with PHP - Fetch / Select > Data from Mysql Database</title> > <link rel="stylesheet" href=" > https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /> > <script src=" > http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></ > script> > </head> > <body> > <br /><br /> > <div class="container" style="width:500px;"> > <h3 align="center">AngularJS Tutorial with PHP - Fetch / Select Data from > Mysql Database</h3> > <div ng-app="myapp" ng-controller="usercontroller" ng-init="displayData()" > > > <label>First Name</label> > <input type="text" name="first_name" ng-model="firstname" class= > "form-control" /> > <br /> > <label>Last Name</label> > <input type="text" name="last_name" ng-model="lastname" class= > "form-control" /> > <br /> > <input type="submit" name="btnInsert" class="btn btn-info" ng-click= > "insertData()" value="ADD"/> > <br /><br /> > <table class="table table-bordered"> > <tr> > <th>First Name</th> > <th>Last Name</th> > </tr> > <tr ng-repeat="x in names"> > <td>{{x.first_name}}</td> > <td>{{x.last_name}}</td> > </tr> > </table> > </div> > </div> > </body> > </html> > <script> > var app = angular.module("myapp",[]); > app.controller("usercontroller", function($scope, $http){ > $scope.insertData = function(){ > $http.post( > "insert.php", > {'firstname':$scope.firstname, 'lastname':$scope.lastname} > ).success(function(data){ > alert(data); > $scope.firstname = null; > $scope.lastname = null; > $scope.displayData(); > }); > } > $scope.displayData = function(){ > $scope.names = new Array; > $http.get("select.php") > .success(function(data){ > console.log("sranje"); > $scope.names = data; > console.log(data); > > }); > } > }); > </script> > > -- > You received this message because you are subscribed to the Google Groups > "Angular and AngularJS discussion" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to angular+unsubscr...@googlegroups.com. > To post to this group, send email to angular@googlegroups.com. > Visit this group at https://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- Lucas Lacroix Computer Scientist Advanced Technology Division, MEDITECH <http://ehr.meditech.com/> 781-774-2293 -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.