php - get multiple values from table1, change them to values based on table2 and write the result to table1 -


hi
I can rewrite the values ​​of a column in a mysql databse based on another column values , But this time I need this to do this with a twist ...
Two tables (and many values ​​at once): Specifications and Products

Products has two columns: specification and specification order
two columns of specification Aswell: id and vs There are several types of formatting in this way in the drawer order

specification : 31,29,27,18,
These id < / Code> are also in the Specifications table. Each id has a specification command value (same line, other column). Now what I want to do, I want to swap the value of id with the specification command and write it on specificationorderids in the same format Products table.
This process must be looped through all the IDs in the Products table.

I hope I thank you for your help!

swap I and specification order , < Strong> specification command , if I believe you:

  ; Php / * Swap ID and specifier order * / $ sql = "SELECT id, specifications from specifications"; $ Result = mysql_query ($ sql); While ($ line = mysql_fetch_row ($ result)) {$ id = $ line [0]; $ Sporder = $ line [1]; $ Sql ​​= "Update Specification SET id = $ id, specificationorder = $ sporder WHERE id = $ id"; Mysql_query ($ sql); } / * Specification in specification order * / $ sql = "selection specification from specifications"; $ Result = mysql_query ($ sql); While ($ line = mysql_fetch_row ($ result)) {$ sporder = $ row [0]; $ Sql ​​= "include products (specification code) values ​​(INR $ sporder)"; Mysql_query ($ sql); }? & Gt;    

Comments