Php+mysql Loop Insert Data: Urgent and urgent

Source: Internet
Author: User
PHP MySQL

Now you want to remove each encoding corresponding to the data to do the insertion: for ($i =0; $i
 
  
"; Echo $sql =" SELECT * from xxx where code = ' $bms [$i] ' "; echo"
";} In detail, if the ' encode ' loop is: 101 102 103 104 What I want to do is//$sql = "select * from xxx where code = ' 101 '//Then encode is 101 corresponding data out to do insert//$sql =" SELECT * F Rom xxx where code = ' 102 '//Then encode is 102 corresponding data is taken out to do the insertion ..... Novice for advice, greatly appreciated, do not know my meaning expressed clearly no, limited technology is learning to hope you do not scold to point tips, guidance


Reply to discussion (solution)

$sql = "INSERT INTO the TT select * from XXX where encoded in ('". Join ("', '", $bms). "')"; mysql_query ($sql);

Thank you.. I'll give it a try

Add success

$SQLL = "INSERT INTO cart (BM,MC,LX) Select Code, name, type, from XXX where encoded in ('". Join ("', '", $bms). " How do you add that $sls value?

What is $sls? Where's the add?

  • 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.