Cyclic report output

Source: Internet
Author: User
How do I use foreach to output cyclic tables? The data in the database is (below is a student's course selection information) on the My Page $ course = $ row ['course _ id']; $ SQL = "select & nbsp; * & nbsp; from & nbsp; think_course & nbsp; where & n Loop Table output
How does foreach output tables?
The data in the database is (below is a student's course selection 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 );
The data in the database is retrieved. now I want to use foreach to output the following form:
Nonameteacher_nameplacetime
The output form on the page is

How to write foreach? I hope you can give me some advice on SQL operations. it is better to paste the code.
Database SQL MySQL industry data select shared:
------ Solution --------------------
$ SQL = "select * from think_selected where stu_id = $ stu ";
Will there be more than one sentence? Add a while clause to $ row = mysql_fetch_array ($ result );
------ Solution --------------------
Outer layer (7 rows) $ result = mysql_query ($ SQL );
Inner layer (17 rows) $ result = mysql_query ($ SQL );
The $ result in the inner layer overwrites the outer layer.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.