deezin Posted August 31, 2007 Share Posted August 31, 2007 ??? Hello. I am transferring data from one script to another script and the new software that I downloaded requires that I have multiple items separated by | in one field. The way I have it now is in 4 different fields. The way it is set up is like this: Table Freelancers Field1 expertise1 Field2 expertise2 Field3 expertise3 Field4 expertise4 Each of these fields have one integer in each of them representing a specific occupation. Each freelancer had 4 occupations that they could choose. This is the data from the old site. On the new site, there is also a list of occupations (in a text file) that is different from the old list. For example, web design = 4 on the old site, and web design = 24 on the new site. So I want to take the 4 occupations (expertise1, expertise2, expertise3, and expertise4) and combine them in a 5th field. I set up a 5th field called specif_occupation to combine the data in ... the information should look something like this when combined |4|5|8|14|76| I only need to know how to combine the 4 fields into 1 field. I could figure out the rest (probably, I'm out of practice). Thank you for your help. Rachel Quote Link to comment https://forums.phpfreaks.com/topic/67398-help-with-combining-a-few-columns-into-one-column/ Share on other sites More sharing options...
Fadion Posted August 31, 2007 Share Posted August 31, 2007 I assume u know how to handle with mysql db. So u can try smth like this: $query = mysql_query('SELECT ocup1, ocup2, ocup3, ocup4 FROM users'); while($values = mysql_fetch_array($query)){ $combined = $values['ocup1'] . '|' . $values['ocup2'] . '|' . $values['ocup3'] . '|' . $values['ocup4']; $queryUpdate = mysql_query("UPDATE users SET specific_ocup='$combined'"); } Hope its what u mean and it helped. Quote Link to comment https://forums.phpfreaks.com/topic/67398-help-with-combining-a-few-columns-into-one-column/#findComment-338370 Share on other sites More sharing options...
deezin Posted August 31, 2007 Author Share Posted August 31, 2007 Thank you. This looks like it will work. I'll let you know tomorrow. Thank you! Rachel Quote Link to comment https://forums.phpfreaks.com/topic/67398-help-with-combining-a-few-columns-into-one-column/#findComment-338371 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.