1

I have written MySQL query to get a number of records from the table. I'm very new to angular js, I don't know how will I display output of it into the Angular js. kindly check with below PHP and MySQL query.

<?php

include("../include/connect.php");

$sql="SELECT clientDB_Status FROM ms_approach_clients where clientDB_Status='Lead-Successful'";

if ($result=mysqli_query($con,$sql))
  {
  // Return the number of rows in result set
  $rowcount=mysqli_num_rows($result);
  printf("Result set has %d rows.\n",$rowcount);
  // Free result set
  mysqli_free_result($result);

  }

mysqli_close($con);
?>

1
  • 1
    An introductory tutorial on Angular seems like the ideal place to start here. Tutorials will cover how to make an AJAX request and handle the response. Commented Apr 22, 2017 at 9:14

1 Answer 1

1

You can try it.

<?php

include("../include/connect.php");

$sql="SELECT clientDB_Status FROM ms_approach_clients where clientDB_Status='Lead-Successful'";

if ($result=mysqli_query($con,$sql))
  {
  // Return the number of rows in result set
  $rowcount=mysqli_num_rows($result);
  printf("Result set has %d rows.\n",$rowcount);
  // Free result set
  $data = array();

while ($row = mysqli_fetch_array($result)) {
  $data[] = $row;
}
    print json_encode($data);


  }

mysqli_close($con);
?>

You can see example link

http://stackoverflow.com/questions/26229382/how-to-display-data-from-mysql-using-angular-js-php
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.