我一直在互联网上寻找解决我问题的方法。我正在自学关系数据库,并试图在我的网页上回应这一点。但它没有回响:(
请一双新鲜的眼睛看看我的代码并指出我正确的方向。非常感谢
我一直在尝试在出于自己的目的进行编辑之前进行测试运行
database: fault
table: user
collumns: id name course
foreign key(fk_course)fault,course,id
table: course
Collumns: id coursename
代码:
<?php
require 'connection.php';
//where statement in the sql syntax will select where in db to get infor, use AND to add another condition
$result = mysqli_query($con,"SELECT user.name, course.coursename FROM 'user' INNER JOIN 'course' ON user.course = coursename.id"); //this creates a variable that selects the database
echo "<table border='1'>
<tr>
<th>Name</th>
<th>Course</th>
</tr>";
while ($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['coursename'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>