PHP Moving Values Between Fields in MySql DB

I’ll keep this as brief as possible,

I have the following columns in my database: fun1, fun2, skill1, skill2, day1, day2, showcase

The respective fields in the columns above are populated by an integer. I want to copy the first and second integers over zero that appear in the above columns into two columns: camp, camp2.

If there are any remaining integers over zero a new row is created and those integers are stored in camp, camp2 within that new row.

Here is an example:

fun1 fun2 skill1 skill2 day1 day2 showcase camp camp2
0 25 0 0 30 15 0 25 30
              15  

I want to know the best method to achieve this, right now all I can think of is a long and treacherous tree of “if” and “else” statements. This just seems impractical, any assistance would be greatly appreciated!

Thank you

Sorry forgot to format my example!
[table]
[tr]
[td]fun1[/td]
[td]fun2[/td]
[td]skill1[/td]
[td]skill2[/td]
[td]day1[/td]
[td]day2[/td]
[td]showcase[/td]
[td]camp[/td]
[td]camp2[/td]
[/tr]
[tr]
[td]0[/td]
[td]25[/td]
[td]0[/td]
[td]0[/td]
[td]30[/td]
[td]15[/td]
[td]0[/td]
[td]25[/td]
[td]30[/td]
[/tr]
[tr]
[td][/td]
[td][/td]
[td][/td]
[td][/td]
[td][/td]
[td][/td]
[td][/td]
[td]15[/td]
[td][/td]
[/tr]
[/table]

Sponsor our Newsletter | Privacy Policy | Terms of Service