Looping table output
How do I do tabular output with foreach?
The data in the database is (the following is a student's elective information)
I'm on the page.
$course = $row [' course_id '];
$sql = "SELECT * from Think_course where id= ' $course '";
$result =mysql_query ($sql);
$row =mysql_fetch_array ($result);
Take out the data in the database and now I want to use foreach to output the following form
NoNameTeacher_namePlaceTime
The output in the page is in the form
How to write foreach, novice just learn SQL operation I hope you teach, can put the code words better.
Database SQL MySQL Industry Data Select
Share to:
------Solution--------------------
$sql = "SELECT * from think_selected where stu_id= $stu";
Will there be more than one sentence? In $row =mysql_fetch_array ($result); Put a while outside this sentence.
------Solution--------------------
Outer layer (7 lines) $result =mysql_query ($sql);
Inner layer (17 rows) $result =mysql_query ($sql);
The inner $result cover the outer layer.