Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将所有列数据转换为行数据。
编号 | 部门名称 | 学生姓名1 | 学生姓名2 | 学生姓名3 | 学生姓名4 | 1 | 呸呸呸| 美国广播公司 | XYZ | 杰尔姆 | tmn |
我创建的这个表和值是使用数组保存的。
我想将所有学生姓名保存在一列中,如下所示:
编号 | 部门名称 | 学生姓名 | 1 | 呸呸呸| 美国广播公司 | 2 | 呸呸呸| XYZ | 3 | 呸呸呸| 杰尔姆 | 4 | 呸呸呸| tmn |
第一个表到数组 $students,伪代码:
for($i=2; $i<sizeof($students);$i++) { mysql_query("insert into 'newTable' ('division name', 'student name') values ($students[1], students[$i]) "); }