Hello, this is my first post in this forum, eventhough my english is not perfect, I'll to explain my problem the best I can, if you understand anything about what I say, just tell me.
I got a code that takes values from a CSV file (Coma Delimited - Excel), something like this:
PHP Code:
key name id last name
J juan 87 perez
J pedro 75 rodriguez
B mario 98 gonzalez
I want to upload these values and place them in a table in the database, this isn't the problem, the problem is that, for example, in 'key' i got a "J" in the first row, I want to link in someway this letter, with other values that I have in ANOTHER table in the same database, the value would be something like "J12345", but there's also more values, let's suppose the table is something like this:
PHP Code:
Table: 'table2'
complete key (Fields)
J2485 (Values)
B8789
J1589
B8796
Now, in the first row of the CSV file that I'm uploading, the key is 'J', it should just take into account the ones that start with the letter 'J', and take the bigger one, in this case would be 'J2485', then I want to add '+1' to this value and insert it in the 'main table' where I'm going to upload everything, the same if changes from 'J' to 'B' or viceversa and I'd want something like this:
PHP Code:
Table: 'main_table"'
key name id last name
J2486 juan 87 perez
J2487 pedro 75 rodriguez
B8797 mario 98 gonzalez
Here is a piece of the code that does this, it's almost complete, but it still shows up some errors: