Title: export csv , not export all data
Last modified: June 6, 2020

---

# export csv , not export all data

 *  [ezako](https://wordpress.org/support/users/ezako/)
 * (@ezako)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/export-csv-not-export-all-data/)
 * I have used CF-repeater and its add new filed named as
    username__1 username__2
   username__3 email__1 email__2 email__3 etc …
 * when exporting about 150 forms to csv, many time didn’t get the repeater data,
   and its only add the first data (username__1) only
 * some user fill the form and they has 1 username, and other have 4 username

Viewing 1 replies (of 1 total)

 *  Thread Starter [ezako](https://wordpress.org/support/users/ezako/)
 * (@ezako)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/export-csv-not-export-all-data/#post-12947880)
 * I found the problem that he gets heading_row from last new form added
    and if
   the last form has 2 username, so the csv will have heading for 2 username username__1,
   username__2
 * also if latest form added had 1 username (username__1), so heading_row will have
   only 1 username (username__1) as in the same time there is another rows has more
   that 1 username
 * I fixed this by sorting the heading_row by the length of value to get the highest
   row to have the most length in form_value
 * line 81,82
 * instead of
 *     ```
        $heading_row = $cfdb->get_results("SELECT form_id, form_value, form_date FROM $table_name
       WHERE form_post_id = '$fid' ORDER BY form_id DESC LIMIT 1",OBJECT);
       ```
   
 * to be
 *     ```
        $heading_row = $cfdb->get_results("SELECT form_id, form_value, form_date FROM $table_name
       WHERE form_post_id = '$fid' ORDER BY CHAR_LENGTH(form_value) DESC LIMIT 1",OBJECT);
       ```
   
 * I hope if you have a better solution
    thanks for your great plugin
    -  This reply was modified 5 years, 11 months ago by [ezako](https://wordpress.org/support/users/ezako/).

Viewing 1 replies (of 1 total)

The topic ‘export csv , not export all data’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-cfdb7/assets/icon-256x256.png?rev=1619878)
 * [Database Addon for Contact Form 7 - CFDB7](https://wordpress.org/plugins/contact-form-cfdb7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-cfdb7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-cfdb7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-cfdb7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-cfdb7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-cfdb7/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [ezako](https://wordpress.org/support/users/ezako/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/export-csv-not-export-all-data/#post-12947880)
 * Status: not resolved