Upload CSV and replace data with foreign keys

Domo

New Member
I want to upload data through CSV files in my contact management application. The CSV file structure is like this:\[code\]Name, Phone, CityJohn Doe, 555-555-5555, New York\[/code\]While the table structure in the db is like this:\[code\]name, phone, city_id\[/code\]In the database, the city name is stored in another table and the foreign key is referenced in the contacts table.My question is how can I replace the city names in the CSV file with city id for insertion into db.Background info: Language is PHP and database is MySQLThanks
 
Back
Top