[thelist] Odd Behavior last night with MySQL Server

Wes Reed wes at thirdstrand.com
Fri Aug 6 10:43:33 CDT 2004


Hi Rob,
         I think the comma in this category "Family, Parenting & Education" 
is causing your problem.

Wes

At 06:40 AM 8/6/2004, you wrote:
>Hi,
>
>Remember the script I told you about yesterday that took a .csv file for
>reading, took all the lines out and placed the contents into sql queries:?
>
>$filename = "/..(absolute path)../test.csv";
>$handle = fopen($filename, "r");
>$contents = explode("\r\n", fread($handle, filesize($filename)));
>
>for ($i = 0;$i<count($contents)-1;$i++)
>{
>   $line = explode(",",stripslashes($contents[$i]));
>   mysql_query("INSERT INTO ofnav VALUES
>(".$line[0].",".$line[1].",".$line[2].",".$line[3].",".$line[4].",".$line[5]
>.")");
>}
>
>fclose($handle);
>
>The contents of the csv are (excerpt):
>
>398,"Home","Books","Cooking","Regional & Ethnic",""
>399,"Home","Books","Cooking","Regional & Ethnic","Asian"
>400,"Home","Books","Cooking","Regional & Ethnic","Cajun & Creole"
>401,"Home","Books","Cooking","Regional & Ethnic","Eastern European"
>402,"Home","Books","Cooking","Regional & Ethnic","European"
>403,"Home","Books","Cooking","Regional & Ethnic","French"
>
>Ok. There are 2103 rows like this in my csv file. I've (now) confirmed that
>5 times. Yet when I run the above script, it will sporadically skip large
>amounts of rows?! In one particular case it will go from "429" skips to
>"519" and "1444" skips to "1638," when there are in fact normal rows just
>like this. Feel free to look at the csv file and see if you see anything
>wrong:
>
>http://www.azuritedesign2.com/One-Fourth/test.csv
>
>These are the INSERT commands generated by the above script:
>
>http://www.azuritedesign2.com/One-Fourth/importdata.php
>
>It all looks like it should work right? Then why am I missing 395 rows of
>data? in different places? Only 1708 get inserted.
>
>Is there a bug in MySQL?
>
>Rob Smith
>--
>* * Please support the community that supports you.  * *
>http://evolt.org/help_support_evolt/
>
>For unsubscribe and other options, including the Tip Harvester
>and archives of thelist go to: http://lists.evolt.org
>Workers of the Web, evolt !





More information about the thelist mailing list