advantus Posted February 23, 2009 Share Posted February 23, 2009 I'm wasted almost an entire day trying to figure this out. So I'm eating crow and coming to the gurus to help me out. Here's what I'm trying to accomplish and I already have it 1/2 done. I have a WordPress theme that I need to enable users to export and import some of the data from the options table in WordPress. Here's the structure of the wp_options table: option_id (autoincrement), blog_id, option_name, option_value, and autoload I already have the export functionality complete, so I end up with the filtered records I want, with column titles, no option_id in the export and it saves as a prenamed csv just like it should. Now I'm trying to build the function that can take that csv file (or any other csv exported from the same theme, just with different settings) and upload it back into the wp_options table. It will obviously require the deletion of any existing values, which isn't a problem because I already have the 'delete' button coded and working to remove those. I've tried a bunch of available scripts, but I'm having problems getting the CSV uploaded as a temp file to the server, then getting the data extracted properly into the table. The option_id obviously needs to assign itself on import, so that's why I didn't include that column in the export csv. I don't need any of the database connection script, because that's already built into the wp-config file that's required at the top of the file. The csv file comes from the file field in the upload form, then when they click on the 'Import' button I want the CSV to be uploaded and imported into the proper table, which is: $table = $wpdb->prefix . 'options'; Does anyone have any scripts that would work to do this? I'm at wits end. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/146591-php-help-to-upload-csv-to-wordpress-mysql-options-table/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.