gpt4 book ai didi

php - 如何使用 Angular 显示 PHP MySQL 查询的输出

转载 作者:行者123 更新时间:2023-11-28 23:16:42 25 4
gpt4 key购买 nike

我编写了 MySQL 查询以从表中获取大量记录。我是 Angular js 的新手,我不知道如何将它的输出显示到 Angular js 中。请检查以下 PHP 和 MySQL 查询。

<?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);
?>

最佳答案

你可以试试。

<?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);
?>

你可以看到示例链接

http://stackoverflow.com/questions/26229382/how-to-display-data-from-mysql-using-angular-js-php

关于php - 如何使用 Angular 显示 PHP MySQL 查询的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43557382/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com