Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8181117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:24:50+00:00 2026-06-07T00:24:50+00:00

I am using AngularJS 1.0, PHP, and mysql with localhost on my Mac. I

  • 0

I am using AngularJS 1.0, PHP, and mysql with localhost on my Mac.

I have a very simple mysql database: “cats”. It has one table called “kittens”. The table has two columns, “id” and “name”. There are three kittens in the database with names Larry, Curly, and Moe.

Now, I have some simple PHP code which opens the dbase, gets the three records, and returns them in JSON like this:
[{“id”:”1″,”name”:”Larry”},{“id”:”2″,”name”:”Curly”},{“id”:”3″,”name”:”Moe”}]

I used the latest angular-seed and set up a project in Eclipse. In app.js I wrote this:
‘use strict’;
angular.module(‘Cats’, [‘ngResource’,’Cats.filters’, ‘Cats.services’, ‘Cats.directives’])
I put my PHP code in the services folder and named it “index.php”. If I navigate to that services/index.php in my browser using localhost on the Mac, I get back the JSON above. So far everything is cool.

Now – ALL I WANT TO DO (!famous last words 😉 is connect to the PHP service I have and display the contents of that Cats table on my main index page using my AngularJS project. Plain old text, no tables, just bind to the available resource and display it.

I have tried all manner of demos online (many are out of date). Can anyone show me one simple, current way to do this? For the life of me I have all kinds of AngularJS demos working but none of them does this simple task in a way I can understand.

Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:24:52+00:00Added an answer on June 7, 2026 at 12:24 am

    This should also work. It’s significantly fewer lines of code, but note that any error handling has been removed:

    function FetchCtrl($scope, $resource) {
      var services = $resource('../services/index.php');
      $scope.data = services.query();
    }
    FetchCtrl.$inject = ['$scope', '$resource'];
    

    Normally I would have used the built in .get() method on the $resouce but your response is in the form of an Array, which .query() supports by default.

    You can find the documentation on $resource here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the AngularJS framework, how do I have the Submit button both update the
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using AngularJS if I set a simple input text box value to something like
I'm building a simple Contact Management app with Crud using AngularJS 1.0.0rc8. Getting a
Using C#, I need a class called User that has a username, password, active
Code in html.haml in Rails using AngularJS %table %tbody{:ng-init => my_model=#{@current_user_things.to_json}} %tr{:ng-repeat => row
Using a populated Table Type as the source for a TSQL-Merge. I want to
I'm using the standard asp:Login control, and we have a user who recently changed
I have several TextBoxes, which display angular values. I format these using different custom
I have gyroscope + accelerometer data at each time period T . Using C++,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.