使用PHP调用要在表中显示的数组
我最近正在开发一个网站作为一个项目,并调用一个数组来使用php在表中显示 我尝试使用as使用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
$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>
不清楚你想问什么清楚你想问什么