Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combination-sort

Status
Not open for further replies.

PerlElvir

Technical User
Aug 23, 2005
68


Hi all, I dont know how to explain so I will make example what I need, so I hope...

I have in MySQL:

1.row Elvir(field1),Damir(field2),Smith(field3),Players(field4)


So now I want tu put in new insert like this:

1.row Elvir(field1)
2.row Damir(field1)
3.row Smith(field1),Players(field2)

SO I need that last field (Players) concat with field before it. I hope that you understud, because some time you'll have only one name or two...so I want to do same like:


1.row Elvir(field1),Damir(field2),Players(field4)


So now I want tu put in new insert like this:

1.row Elvir(field1)
2.row Damir(field1),Players(field2)

Well you never know how many names you have 1,2 or....but always in field4 = Players and I want that last name concat with field4 = Players


So... ;)






 
Code:
Name    |  Position
--------+------------
Elvir   |
Damir   |
Smith   | Players

Are you saying that Elvir and Damir are not players?

I'm a bit confused, can you elaborate?

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
field1 | field2 | field3 | field4 |
--------+-----------+---------+----------+-
Elvir | Damir | Smith | Players |

so now I want to get

field1 | field2 | field3 | field4 |
--------+-----------+---------+----------+-
Elvir |
Damir |
Smith | Players |

so every time last name must have in field2 = Players, but I dont know how many names I have can be also:

field1 | field2 | field3 | field4 |
--------+-----------+---------+----------+-
Elvir | Damir | | Players |


and now I want:

field1 | field2 | field3 | field4 |
--------+-----------+---------+----------+-
Elvir |
Damir | Players |
 
pseudocode
Code:
Read the table into an array
For (length of array-1) {
  insert into table2 (field1) values ($_);
}
insert into table2 (field1, field2) values ($array[$#array-1], "Players");

I'm not sure this is what you need though, what does field 2 in the first example tell you about Elvir and Damir

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 

now Im put @array=(field1,field2,field3,field4)
point is that every time last name in array have in field2 = Players, but now somtimes field3 or field4 is empty so $array[-1] I get nothing :(
 


Friend call me so I go out, see you tonight or tomorrow ;) Thank you on respons :eek:) I hope that you understud what I want
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top