• Resolved Pixelatic

    (@davidhealy)


    WordPress Store Locator is throwing the following error on the front end in WordPress 3.9/PHP 5.5.9

    Warning: mysql_real_escape_string(): Access denied for user 'david'@'localhost' (using password: NO) in /var/www/wp-content/plugins/store-locator/sl-functions.php on line 324

    Line 324 of /var/www/wp-content/plugins/store-locator/sl-functions.php:

    $on_sl_page=$wpdb->get_results("SELECT post_name, post_content FROM ".SL_DB_PREFIX."posts WHERE LOWER(post_content) LIKE '%[store-locator%' AND post_status IN ('publish', 'draft') AND (post_name='$pagename' OR ID='".mysql_real_escape_string($_GET['p'])."' OR ID='".mysql_real_escape_string($_GET['page_id'])."')", ARRAY_A);

    Traced to changes made to WPDB in 3.9 https://make.www.ads-software.com/core/2014/04/07/mysql-in-wordpress-3-9/

    For plugin developers, this means that you absolutely shouldn’t be using PHP’s mysql_*() functions any more – you can use the equivalent WPDB functions instead.

    mysql_real_escape_string()
    For a drop in replacement, you can use esc_sql().

    Hopefully this can get rolled out as a fix in the next release. Thanks, David

    https://www.ads-software.com/plugins/store-locator/

  • The topic ‘Database Errors in WordPress 3.9’ is closed to new replies.