table field Replication Issues

Source: Internet
Author: User
Now there are table A and table B

A structure

ID Username Genre pattern
1 MR.A 0 Sales
2 MR.B 1 Manager
3 MR.C 0 Sales

B structure

ID model field Name setting CSS
1 area

Now I want to copy the a table field into the B record,

The following structure:
ID model field Name setting CSS
1 area
2 Username user Name
3 genre Sex
4 Pattern Positions

The manual didn't turn out, the novice consulted


Reply to discussion (solution)

$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);


Get the information of the fields in the table, how to deal with the landlord to write their own sentences decided

PHP reads the log to the array, then takes the array key value to write the database again, this already knew. Now you want to write directly with SQL.
Fortunately in the SQL section to find the answer, all table fields are recorded by MySQL

  • Related Article

    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.