Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用PHP调用要在表中显示的数组_Php_Sql - Fatal编程技术网

使用PHP调用要在表中显示的数组

使用PHP调用要在表中显示的数组,php,sql,Php,Sql,我最近正在开发一个网站作为一个项目,并调用一个数组来使用php在表中显示 我尝试使用as$key来$value <body class = "w3-center"> <?php $link = mysqli_connect("localhost", "root", "", "weblek"); // Check connection if ($link === false) { die("ERROR: Could not connect. " . mysqli_conn

我最近正在开发一个网站作为一个项目,并调用一个数组来使用php在表中显示

我尝试使用as
$key
$value

<body class = "w3-center">
<?php
$link = mysqli_connect("localhost", "root", "", "weblek");
// Check connection
if ($link === false) {
    die("ERROR: Could not connect. " . mysqli_connect_error());
}
// Attempt select query execution
$sql = "SELECT applying_for, COUNT(applying_for) AS 'Total' FROM           `registration` WHERE status = 'enrolled' GROUP BY applying_for";
if ($result = mysqli_query($link, $sql)) {
    if (mysqli_num_rows($result) > 0) {
        echo "<table>";
        echo "<tr>";
        echo "<th> COURSE </th>";
        echo "<th> ENROLLED </th>";
        echo "<th> OUT OF </th>";
        echo "</tr>";
        while ($row = mysqli_fetch_array($result)) {
            echo "<tr>";
            echo "<td>" . $row['applying_for'] . "</td>";
            echo "<td>" . $row['Total'] . "</td>";
            echo "<td>" . $result1[0] . "</td>";
            echo "</tr>";
        }
        mysqli_free_result($result);
    } else {
        echo "No records matching your query were found.";
    }
} else {
    echo "ERROR: Could not able to execute $sql." . mysqli_error($link);
}
// OUT OF --
$sql     = "SELECT COUNT(applying_for) AS 'Total' FROM `registration` WHERE position = 'student' GROUP BY applying_for";
$result1 = array(
    $sql
)
// Close connection
    ?>
</body>


不清楚你想问什么清楚你想问什么