表字段复制有关问题

WBOY
Release: 2016-06-13 12:51:51
Original
697 people have browsed it

表字段复制问题
现在有表A 和表B

A结构

id  username genre pattern
1   mr.a     0       销售
2   mr.b     1       经理
3   mr.c     0       销售

B结构

id  model  field name setting css
1    12    area  地区   

现在想把A表字段复制成B表记录,

即如下结构:
id  model  field       name setting css
1    12    area        地区
2    15    username    用户名
3    15    genre       性别
4    15    pattern     职位

手册没翻出来,新手求教


------解决方案--------------------
<br />
<br />
$link = mysql_connect("localhost", "root", "pwd") or die("Could not connect: " . mysql_error());<br />
<br />
mysql_select_db("dbName", $link);<br />
<br />
$result = mysql_query("show fields from tableName") or die("Could not query:" . mysql_error());<br />
<br />
while($re = mysql_fetch_array($result)){<br />
   echo $re[0];<br />
   echo '<br />';<br />
}<br />
<br />
mysql_close($link);<br />
<br />
Copy after login


获得了表中字段的信息,要怎么处理楼主自己写语句决定咯
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template