Php + mysql insert data cyclically .. Urgent

Source: Internet
Author: User
Tags mysql insert
Php + mysql insert data cyclically .. Urgent and urgent PHP MySQL

// Now we need to extract the data corresponding to each encoding for insertion .. For ($ I = 0; $ I

 
  
  ";echo $sql="select * from xxx where 编码='$bms[$i]'";echo "
  
  
";}//详细说明,上面假如'编码'循环为:101 102 103 104 我要做的事是//$sql="select * from xxx where 编码='101' //然后把编码是101对应的数据取出来做插入//$sql="select * from xxx where 编码='102' //然后把编码是102对应的数据取出来做插入。。。。。//新手求教,不胜感激,不知道我的意思表达清楚了没有,技术有限正在学习中望各位不要骂给点提示,指导


Reply to discussion (solution)

$ SQL = "insert into tt select * from xxx where encoding in ('". join ("','", $ bms ). "')"; mysql_query ($ SQL );

Thank you .. Try Me

// Added

$ Sqll = "insert into cart (bm, mc, lx) select encoding, name, type, from xxx where encoding in ('". join ("','", $ bms ). "')" // add the $ sls value.

$ What is sls? Where to add it?

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.