PHP를 사용하여 HTML 테이블에 MySQL 테이블의 데이터를 표시하려고합니다. StackOverflow에 대한 답변을 포함하여 몇 가지 온라인 자습서를 살펴 보았습니다 ... 구현했습니다 방법은 자습서가 설명했다 그러나 나는 출력을 얻고있다.PHP와 MySQL을 사용하여 html 테이블 데이터 삽입하기
<table border="1px solid black" cellpadding="0px" cellspacing="0px" width="100%">
<thead>
<tr>
<th>Date</th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
<th>Saturday</th>
<th>Sunday</th>
</tr>
</thead>
<?php
include('dbConnect.php');
$sql = "SELECT * FROM nurses";
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result)) {
echo "<tr>";
echo "<td>" . $row['idno'] . "</td>";
echo "<td>" . $row['surname'] . "</td>";
echo "</tr>";
}
?>
</table>
내가 이것을 테스트 할 때 내 db 연결이 성공적이라는 것을 알고 있습니다. 출력되는 것은 모두 <thead>
이며 그 다음에는 아무 것도 출력되지 않습니다. 왜 이것이 작동하지 않는지 이해할 수 없습니다 :/
mysql_로 * 기능이 결과에 아니라고 경우
http://php.net/manual/en/function.mysql-query.php 그런데, 더 이상 사용되지 않는 mysqli_ 스틱 * – ksealey
모두가 출력되는 "머리글 행", 나는 당신이 의미한다고 생각하니? –
연결되는 것; 'mysqli_','mysql_', PDO? 이'$ result = mysql_query ($ sql) or die (mysql_error());'를 실행하고 http://php.net/manual/en/function.error-reporting.php를 사용하십시오 - 플러스 파일은'.php '또는'.html'? –