YogeshChauhan . com

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).

amazon

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 How to Use SQL MAX() Function with Dates? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

Jun 16 What are Stored Procedures for SQL Server? Jun 16 What are Class Constants in PHP? Jun 15 A short basic guide on states in React Jun 15 How to define constants in PHP? Jun 15 How to define visibility for a property in PHP? Jun 15 How to use @if and @else in SCSS?

You might also like these

The SQL UNION OperatorSQL/MySQLWhat does Containment mean in React?ReactWhen you don’t want to @forward every member in SCSS (Sass)SCSSThe difference between isFinite() method and isFinite() function in JavaScriptJavaScriptHow to make a Custom Login Page in WordPress?WordPressHow to use GROUPING SETS to boost GROUP BY queries in Postgres?Postgres