Ich will Details in meiner database.I Verwendung von zwei Tabellencode folgt erhaltenLernen Sie eine Abfrage mit zwei Tabellen
$sqlall="SELECT
student_detail.reg_no
, student_detail.full_Name
, student_detail.year_of_study
, student_detail.faculty
, student_detail.course
,student_hostel.reg_no
,student_hostel.room_no
,student_hostel.hostel_id
FROM student_detail,student_hostel
WHERE student_detail.reg_no = student_hostel.reg_no; ";
//This is print part
$result = $conn->query($sqlall);
if ($result->num_rows > 0) {
// output data of each row
//create table
echo "<table class=\"table table-hover\">
<tr>
<th>Reg. No.</th><th>Hostel id</th><th>Room No</th></tr>";
while($row = $result->fetch_assoc()) {
echo"<tr id=\"".$row["student_detail.reg_no"]."\" onclick=\"Redirect(this.id)\"><td>".$row["student_detail.reg_no"]."</td><td>".$row["student_hostel.room_no"]."</td><td>".$row["student_hostel.room_no"]."</td></tr>";
}
echo "</table>";
}
else
{
echo "<table class=\"table table-hover\">
<tr>
<th>Reg. No.</th><th>Hostel id</th><th>Room No</th></tr>;
<span id></span>
</table>";
}
nach Daten in Gang zu bringen, dann ist ein Fehler aufgetreten
Hinweis : Undefined index: student_detail.reg_no in C: \ xampp \ htdocs \ HMS \ HMS \ lib \ HOS_current.php auf 47 Linie
Wie kann ich es beheben?
Sie müssen mehr schreiben, als daß dann –
bitte echo nur die Zeile ohne die Tabellennamen 'echo $ row [ 'reg_no']; ' –
bearbeiten Sie die Frage mit dem Code, wenn Sie die Abfrage ausführen und wie Sie es anzeigen –