Loading ...
Sorry, an error occurred while loading the content.

Problems while exporting data using pipe symbols

Expand Messages
  • Sou H
    Hi Frends, I am facing problems while trying to export data into pipe format. In fact I am fetching records from mysql database and then trying to create a
    Message 1 of 3 , Feb 2, 2006
    • 0 Attachment
      Hi Frends,

      I am facing problems while trying to export data into pipe format. In fact I am fetching records from mysql database and then trying to create a text file ( using pipe as delimeter) , intending to open in Excel.

      The data is been inserted from textarea fields, where the user can write text and may press enter key to format his text accordingly. Now when the data entered into the database it keeps some unidentified value so as to keep the formatting. Hence while displaying the text file I find that lines are seperated according to the format user gave. Thus creating the problem while opening up in the excel file.

      example:

      First Name: Mark [Text Field].
      Second Name: Heyden ]Text Field].
      Address: xyz (Enter Key pressed)
      abc, (Enter Key pressed)
      def. (Enter Key pressed)
      [TextArea]

      Hence the record I expect should be in the text file like,

      Mark | Heyden | xyz abc,def.

      But I am getting it as

      Mark | Heyden | xyz
      abc,
      def.
      I would appreciate if some one can give me the solution, how i can get rid of the situation.

      Thanks,
      Sougat



      ---------------------------------
      Bring words and photos together (easily) with
      PhotoMail - it's free and works with Yahoo! Mail.

      [Non-text portions of this message have been removed]
    • lachhekumar KumarKumar
      hi You cannot export the textarea field directly to the pipe delimeted file. use this function for encoding and decoding function enCodeExcel($value) { $value
      Message 2 of 3 , Feb 3, 2006
      • 0 Attachment
        hi


        You cannot export the textarea field directly to the
        pipe delimeted file.

        use this function for encoding and decoding

        function enCodeExcel($value)
        {
        $value = str_replace("\n","\\n",$value);
        $value = str_replace("\r","\\r",$value);
        $value = str_replace(chr(13),"\\n",$value);

        return $value;
        }


        function deCodeExcel($value)
        {
        $value = str_replace("\\n","\n",$value);
        $value = str_replace("\\r","\r",$value);

        return $value;
        }


        Use enCodeExcel while importing to excel file...

        Note: Will prefer to use the comma delimeted format
        for the excel file... with the column enclosing



        Thanks
        Kumar
        --- Sou H <sou_h007@...> wrote:

        > Hi Frends,
        >
        > I am facing problems while trying to
        > export data into pipe format. In fact I am fetching
        > records from mysql database and then trying to
        > create a text file ( using pipe as delimeter) ,
        > intending to open in Excel.
        >
        > The data is been inserted from textarea
        > fields, where the user can write text and may press
        > enter key to format his text accordingly. Now when
        > the data entered into the database it keeps some
        > unidentified value so as to keep the formatting.
        > Hence while displaying the text file I find that
        > lines are seperated according to the format user
        > gave. Thus creating the problem while opening up in
        > the excel file.
        >
        > example:
        >
        > First Name: Mark [Text Field].
        > Second Name: Heyden ]Text Field].
        > Address: xyz (Enter Key pressed)
        > abc, (Enter Key pressed)
        > def. (Enter Key pressed)
        > [TextArea]
        >
        > Hence the record I expect should be in the text file
        > like,
        >
        > Mark | Heyden | xyz abc,def.
        >
        > But I am getting it as
        >
        > Mark | Heyden | xyz
        > abc,
        > def.
        > I would appreciate if some one can
        > give me the solution, how i can get rid of the
        > situation.
        >
        > Thanks,
        > Sougat
        >
        >
        >
        > ---------------------------------
        > Bring words and photos together (easily) with
        > PhotoMail - it's free and works with Yahoo! Mail.
        >
        > [Non-text portions of this message have been
        > removed]
        >
        >
        >
        >


        __________________________________________________
        Do You Yahoo!?
        Tired of spam? Yahoo! Mail has the best spam protection around
        http://mail.yahoo.com
      • AMUDHA BALAN
        Hello Sougat, The fact with Text area is that the Enter Key will be considered as a html break ( ) and will be stored in MySQL as . The trouble what
        Message 3 of 3 , Feb 3, 2006
        • 0 Attachment
          Hello Sougat,

          The fact with Text area is that the "Enter Key" will
          be considered as a html break (<br>) and will be
          stored in MySQL as "<br>".

          The trouble what i think is that the html "<br>" tag
          is being stored and gets interpreted by the file...

          I would say using "strip_tags()" will get you clear
          this issue...

          Happy Programming... :)





          __________________________________________________
          Do You Yahoo!?
          Tired of spam? Yahoo! Mail has the best spam protection around
          http://mail.yahoo.com
        Your message has been successfully submitted and would be delivered to recipients shortly.