使用php从mysql中的两个数据库中获取多个表

使用php从mysql中的两个数据库中获取多个表,php,mysql,Php,Mysql,我在Mysql数据库中有两个表,表1 serial Remark ------------------- 1 programming in c++ 2 OOPS using java 和表2 Name date code serial ------------------------------------- Jack 2014-10-07 c++ 1 Jill

我在Mysql数据库中有两个表,表1

serial      Remark   
-------------------
1           programming in c++ 
2           OOPS using java    
和表2

Name      date         code    serial
-------------------------------------
Jack     2014-10-07    c++        1
Jill     2014-10-07    c++        1 
Moos     2014-10-07    c++        1
Jack     2014-10-08    java       2
Jill     2014-10-08    java       2
我想在HTML中使用php生成多个表

<1> C++编程中的学生是

Name      date       
-------------------
Jack     2014-10-07
Jill     2014-10-07
Moos     2014-10-07
2.使用java学习OOPS的学生

Name      date       
-------------------
Jack     2014-10-08
Jill     2014-10-08
有人可以建议查询吗?

案例1的查询:

SELECT name, date from table2 inner join table1 on table2.serial = table1.serial where Remark='programming in c++'
SELECT name, date from table2, table1 where table2.serial = table1.serial and Remark='programming in c++'
查询案例2:

SELECT name, date from table2 inner join table1 on table2.serial = table1.serial where Remark='OOPS using java'
SELECT name, date from table2, table1 where table2.serial = table1.serial and Remark='OOPS using java'
或者

另一种方式:

查询案例1:

SELECT name, date from table2 inner join table1 on table2.serial = table1.serial where Remark='programming in c++'
SELECT name, date from table2, table1 where table2.serial = table1.serial and Remark='programming in c++'
查询案例2:

SELECT name, date from table2 inner join table1 on table2.serial = table1.serial where Remark='OOPS using java'
SELECT name, date from table2, table1 where table2.serial = table1.serial and Remark='OOPS using java'

表1在这里的重要性是什么?遗漏了什么?表1中的序号有备注,但表2有课程代码。。序列号映射在HTML中使用PHP?你能提出这个问题吗?听起来像是一个简单的SELECT查询。是否可以通过循环生成所有备注的表?是否可以通过循环生成表而不是硬编码。表1中的条目当然是动态添加的。参考这个,,