所以我的目標是將兩個數據打印到一個標準表中。從兩張表打印數據
理想情況下,它應該顯示每個不同的獎學金名稱和它的表與所有申請它的學生列表。我不確定我的方法是否正確。
請幫助,我想學習的基礎知識。提前致謝。
<?php
include_once 'function.php';
connect();
?>
<html><body>
<?php
$query = "SELECT *
FROM entry, student_details
WHERE entry.user_id=student_details.user_id";
//run query
$result = mysql_query($query);
// creating a table
echo "<table border='1'>
<tr>
<th>Student ID</th>
<th>Student Name</th>
</tr>";
//Print the record that matches the criteria of the query
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo $row['s_name']
{
echo "<tr>";
echo "<td>" . $row['student_id'] . "</td>";
echo "<td>" . $row['student_name' ] . "</td>";
echo "</tr>";
}
}
?>
</table>
<?php close()
?>
</body></html>
錯誤我得到的是這樣解析錯誤:行echo "<tr>";
而且,語法錯誤是?我知道它在哪裏,但你沒有指出OP在哪裏犯了這個錯誤。你所做的只是粘貼OP的代碼。 –
在那裏的語法錯誤有太多的開始和結束括號。我發佈的代碼是剛刪除它 –