Jump to content

Recommended Posts

???

 

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

 

 

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.