表欄位複製問題

來源:互聯網
上載者:User
現在有表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 職位

手冊沒翻出來,新手求教


回複討論(解決方案)

$link = mysql_connect("localhost", "root", "pwd") or die("Could not connect: " . mysql_error());mysql_select_db("dbName", $link);$result = mysql_query("show fields from tableName") or die("Could not query:" . mysql_error());while($re = mysql_fetch_array($result)){   echo $re[0];   echo '
';}mysql_close($link);


獲得了表中欄位的資訊,要怎麼處理樓主自己寫語句決定咯

php讀取記錄到數組,然後取數組索引值 再寫入資料庫,這個已經知道了。現在想直接利用SQL寫入。
還好在SQL板塊找到答案了,所有 表欄位都被mysql記錄了

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.