mysql - Handling $resource request from PHP backend using SLIM -


i'm having problems accessing php backend angularjs.

i have followed:

http://coenraets.org/blog/2012/02/sample-application-with-angular-js/

routing angularjs , slim php

some other's similar. i've tackled problem few days , still can't working.

first way call php script

app.controller('phonedetailctrl',function($scope, $modal, $resource) { var request_id = 1; var request = $resource('http://mobiiltelefonid24.ee/api/kasutatud_telefonid/'+request_id); $scope.request = request.get();} //this way code 200 119 empty chars.. figure routing should correct? 

second way tried

app.controller('phonedetailctrl',function($scope, $modal, service) { $scope.request =  service.get({id:1});} //this gives me code 200 119 empty chars...  app.service('service', function ($resource) { return $resource('api/kasutatud_telefonid/:id', {}, {     update: {method:'put'} });}); 

php code (using mysql db)

require 'slim/slim.php';  $app = new slim();  $app->get('/', 'getpopularphones'); $app->get('/uued_telefonid','getnewphones'); $app->get('/kasutatud_telefonid','getusedphones'); $app->get('/uued_telefonid/:id', 'getphonedesc'); $app->get('/kasutatud_telefonid/:id', 'getphonedesc');  $app->run();  /*other methods same different name*/  function getphonedesc($id) {     $sql = "select * phone";     try {         $db = getconnection();         $stmt = $db->query($sql);           $wines = $stmt->fetchall(pdo::fetch_obj);         $db = null;         echo json_encode($wines);     } catch(pdoexception $e) {         echo '{"error":{"text":'. $e->getmessage() .'}}';      } } 

getconnection() implemented shown in wine app tutorial. there 1 row in db has 21 colums should return something. tried pass string $wine="teststring" arrived jibbrjabbre.

is routing wrong or there problems querying db? (i can query fine phpmyadmin). out of ideas...

solved! slim falsely configured , meekrodb worked fine (thanks mainguy). on top of there issues on webhosts side.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -