PHP/MySQL LOAD DATA LOCAL INFILE...

From: Date: Thu, 07 Sep 2000 19:27:32 +0000
Subject: PHP/MySQL LOAD DATA LOCAL INFILE...
Groups: php.db 
Request: Send a blank email to php-db+get-2709@lists.php.net to get a copy of this message
Before I say anything, let me say I checked the archives, found info about this, but seem to be hitting a different problem than usual... With that said, I wrote a script to upload a comma seperated text file to the server - from there it does a mysql_db_query() that does the LOAD DATA... - it works. The data gets chucked into MySQL - however, it's all screwed up in there. It shows up as 3000 records when I'm only testing with 11. Very very very few of the fields end up in the right place. I'm trying to load it and let MySQL determine the UID for the field (there's an autoincrement uid field). Will it do this, or do I need to have a uid in the records I'm uploading? Any ideas as to why it creates 3000 records would be helpful too. A code snippet is below... exec("mv $upload $base/data/$media_name"); chmod($base."/data/".$media_name, 0755); mysql_db_query($database, "LOAD DATA LOCAL INFILE \"/full_path_to_file_here\" into table my_table FIELDS TERMINATED BY ',' LINES TERMINATED BY '\"' (program_title, program_term, program_year, program_dates, location, program_desc_1, program_desc_2, program_desc_3, program_desc_4, academic_desc_1, academic_desc_2, academic_desc_3, academic_desc_4, courses_1, courses_2, courses_3, courses_4, faculty_1, faculty_2, faculty_3, faculty_4, academic_credit_1, academic_credit_2, academic_credit_3, overseas_institution, accommodations_1, accommodations_2, accommodations_3, meals_1, meals_2, excursions_1, excursions_2, excursions_3, cultural_activities_1, cultural_activities_2, cultural_activities_3, cultural_activities_4, airfare, program_fee, program_includes_1, program_includes_2, program_includes_3, program_includes_4, program_includes_5, program_doesnt_include_1, program_doesnt_include_2, program_doesnt_include_3, program_doesnt_include_4, payment_sched_1, payment_sched_2, sponsoring_institution, eligibility_1, eligibility_2, how_to_apply_1, how_to_apply_2, for_more_info_1, for_more_info_2, keywords, images)"); Thanks, Joe

« previous php.db (#2709) next »