WP Database Error (Windows Server 2008 & SQL Server)

I have a WP site up and running for my wife and she attempted to install a text widget that linked to her Twitter account (she says HTML was taken from Twitter.com). I am not sure exactly what she did or what was going on, but now she gets the following error when going to /wp-admin of the site:

WordPress database error Array for query INSERT INTO `wp_options` (`option_name`, 
`option_value`, `autoload`) VALUES ('widget_text', 'a:2:{i:2;a:0:{}
s:12:"_multiwidget";i:1;}', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES
(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES
(`autoload`)--SERIALIZED made by require_once, require_once, require_once, 
require_once, do_action, call_user_func_array, wp_widgets_init, do_action, 
call_user_func_array, WP_Widget_Factory->_register_widgets, WP_Widget->_register, 
WP_Widget->get_settings, wp_convert_widget_settings, update_option, add_option 

I have no idea what this even means. I am running WP on a Windows Server 2008 installation with SQL Server 2008. If you need more information, I will be glad to supply it. I really am not sure how to recover her site from this.

Read More

Thanks!

Edit: This site has been running fine for a month now and just now blew up after adding the text widget and adding the Twitter HTML.

Edit 2: I found the offending JavaScript in the wp_options (widget_text) and removed it but am still receiving the same error listing on the admin page.

Related posts

Leave a Reply

3 comments

  1. ON DUPLICATE KEY UPDATE is one of several MySQL-specific things used by WP. Best I’m aware there is no equivalent in SQL-Server. You’ll get a syntax error no matter unless you regexp_replace() every query sent to the DB server in order to rewrite the SQL as needed for your specific engine.

  2. Open your favorite SQL frontend…find the wp_options table. Search for the sidebar_widgets key. You’ll find a serialized array in the option_value.

    You can either try identifying which one is the malicious text widget in question and hand-remove it from the serialized array (which requires you to be able to interpret/rewrite serialization), or just wipe the whole option_value field.

    That will hopefully give you access to admin again and you can then reconfig your widgets.

    Edit: second approach:
    Ok…try this instead: look for widget_text. Again, you’ll find a big serialized array. You’ll find a pattern in there like this: a:3:{s:5:"title";s:...:".......";s:4:"text";s:...:"........" Each of those is the beginning of the definition of one of your text widgets. Find the one that looks like the twitter one and erase everything between the quotation marks of the text part (that is the fourth set of quotation marks in the above pattern).