How to generate .csv files with data from mysql ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tanyali
    New Member
    • Feb 2007
    • 43

    How to generate .csv files with data from mysql ?

    using php, I wanna to get .csv files with data selected out from mysql.

    who knows, please help. thanks first. .~_~.


    Tanya
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, tanyali.

    Try using a SELECT ... INTO OUTFILE query.

    Comment

    • nallaraju
      New Member
      • Jul 2007
      • 1

      #3
      hi folks,
      i am able to get csv file for 1000 records. my problem is i need generate csv file for large data means around 20,000 records for this its exceeds max execution time. so i need some more optimization for data anybody help me in this i am very thankful.

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya nallaraju. Welcome to TSDN!
        Originally posted by nallaraju
        i am able to get csv file for 1000 records. my problem is i need generate csv file for large data means around 20,000 records for this its exceeds max execution time.
        You could increase your max execution time directive (in php.ini for example if you use PHP).

        Alternatively, you can use LIMIT to only output 1000 entries at a time.

        Comment

        • mwasif
          Recognized Expert Contributor
          • Jul 2006
          • 802

          #5
          If you don't have access to php.ini then you can use set_time_limit( ) to increase execution time in PHP script. Sometimes it is beneficial to use mysql_unbuffere d_query() instead of mysql_query() for huge data.

          Take a look at this to use generate csv using PHP.

          Comment

          Working...