Yogesh Chauhan's Blog

Solution to “Call to undefined function mysql_error()” in RevSlider WordPress Plugin

in WordPress on February 12, 2021

Recently I was working on a website that has old RevSlider from 2014! It never got updated and the previous developers never cared to check or update the theme or the slider plugin.

Since WordPress is migrating to jQuery 3.x, I went to check into the site to make sure none of the plugins are dependent on jQuery and if they are, I need to add some fixes if the plugin devs don’t do anything.

Well, it turned out that none of the plugins were updated and it was running on old WordPress from 2014!

The people who developed the website couldn’t breathe without RevSlider plugin and I had to update everything. They bought the theme and the plugin came with it so they didn’t have a clue on what was going on. So, as soon as I updated the WordPress, the whole site broke into pieces!

So, I am going to add a quick fix that worked for me but first let’s see what the error looked like.

The error starts with “Fatal error: Uncaught Error: Call to undefined function mysql_error()”

My error was pointing to couple of files in the slider plugin directory.

The first error was base_admin.class.php which is located at wp-content/plugins/revslider/inc_php/framework/base_admin.class.php

The variable $arrMetaBoxes was defined as a string and I changed that variable to an array. your error should mention the line number as well.

$arrMetaBoxes = ""; // remove this

$arrMetaBoxes = array(); // add this 

The second error was pointing db.class.php which is located at wp-content/plugins/revslider/inc_php/framework/db.class.php

The function RevSlider is calling was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used.

On PHP official site, there is a mention of this error.

Here is the fix:

if(mysql_error()){ // remove this

if($this->wpdb->last_error){ // add this

Both of the errors mention the line number and variable so that it makes our job a bit easier (not a whole lot though).

Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to add Read More Read Less Button using JavaScript? #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#Aug 15 Is PHP still good for back-end programming? #Aug 10 How to create a multisite network in WordPress? #Aug 3 How to create a circle that follows a cursor using JavaScript and CSS? #Aug 3 How to make a curtain slider using jQuery and CSS? #Aug 2 How to progressively load images and add a blurry placeholder? #Aug 1 How to create a placeholder loader (throbber) using CSS?
You might also like these
The difference between Class declarations and Class expressions in JavaScriptJavaScriptThe Drupal flowDrupalWordPress: How to get ACF field values from another post?WordPressLearn how to give a temporary name to a column or to a table using SQL AliasesSQL/MySQLHow to make a UILabel clickable in Swift 5?SwiftHow to show and hide an element on click in React?React