First character problem while reading .csv files

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
realite
Forum Newbie
Posts: 5
Joined: Mon May 05, 2008 2:31 am
Location: Turkiye

First character problem while reading .csv files

Post by realite »

~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


Hi guys,

I'm reading a csv file and i write values which comes from csv to mysql table. while i do this op
for ex. "ÇAMDA?" value records to table as "AMDA?".
As you see the "Ç" isn't recorded but "?" has been recorded, so i'm not sure the whole problem is charset.

how can i do about this??

Code: Select all

 
$handle = fopen ("../csv/".$filename."","r");
 
while ($data = fgetcsv ($handle,4096,";")) {
if ($row>=2){
            $add_news = $Engine->SQL("insert into ".TABLE_POMPA." set
                    ID          = '".$data[0]."', 
                    IL          = '".$data[1]."',
                    KBENZIN     = '".$data[2]."',
                    OKTAN98     = '".$data[3]."', 
                    SBENZIN     = '".$data[4]."',
                    GAZYAGI     = '".$data[5]."',
                    MOTORIN     = '".$data[6]."', 
                    PPM350      = '".$data[7]."',
                    KYAKITI     = '".$data[8]."',
                    FOIL6       = '".$data[9]."'
                ");
}
 

~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.
Post Reply