• loisovervoorde

    (@loisovervoorde)


    Hi!

    Thanks for the great plugin.
    I’m having a slight issue with exporting to CSV. I have created two tables with your plugin. CSV export works fine for this:

    add_db_table_editor(
    
    	array( 
    		'title'=>'Committee', 
    		'table'=>'ssbc_committee', 
    		'id_column'=>'ID', 
    		'sql'=>'SELECT * FROM ssbc_committee ORDER BY EndYear DESC' 
    		)
    	);

    But not for this (I get “This page isn’t working ssbc.org.uk is currently unable to handle this request. HTTP ERROR 500”):

    add_db_table_editor(
    	
    	array( 
    		'title'=>'BCD prices', 
    		'table'=>'ssbc_postmeta', 
    		'id_column'=>'meta_id', 
    		'sql'=>	"select 
    				post_id,
    				max(IF(meta_key LIKE 'attribute_pre-drinks', meta_value, NULL)) AS 'Pre-drinks',
    				max(IF(meta_key LIKE 'attribute_dinner-drinks', meta_value, NULL)) AS 'Dinner drinks',
    				max(IF(meta_key LIKE 'attribute_post-drinks', meta_value, NULL)) AS 'Post-drinks',
    				sum(IF(meta_key LIKE '_regular_price', meta_value, NULL)) AS 'Price'
    				from ssbc_postmeta
    				WHERE post_id IN (SELECT ID FROM ssbc_posts WHERE post_parent = 3692)
    				GROUP BY post_id"
    		)
    	);
    }

    Is it an issue with the length of the query? Is there any way round this?

    Thank you!

    Lois

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m facing the same issue. Export causes Internal error. I’m using limit and order by in the query

    Plugin Author bobbysmith007

    (@bobbysmith007)

    Can you ensure that DB errors are logged and then check your php-error log? This is probably / almost certainly something borked in the query it is running. I use a SQL parser to try and safely insert WHERE clauses, so that my guess is that something about that is failing.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can’t export to CSV’ is closed to new replies.