Error: 0 Call to undefined function mysql_real_escape_string()

This forum is for general questions about extensions for Joomla! 3.x.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
sylwekb
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 118
Joined: Mon Mar 14, 2011 5:08 pm

Error: 0 Call to undefined function mysql_real_escape_string()

Postby sylwekb » Sun Aug 06, 2017 2:09 pm

Joomla 3.7.4
Hello
After installing and publishing the module, the following error appears.
Error: 0
Call to undefined function mysql_real_escape_string()
How can this be fixed?
https://extensions.joomla.org/extension ... t-my-text/

User avatar
toivo
Joomla! Exemplar
Joomla! Exemplar
Posts: 8524
Joined: Thu Feb 15, 2007 5:48 am
Location: Nottingham, UK
Contact:

Re: Error: 0 Call to undefined function mysql_real_escape_string()

Postby toivo » Wed Aug 09, 2017 12:03 am

This extension is obsolescent because it uses the PHP function mysql_real_escape_string() which was deprecated in PHP 5.5.0 and removed in PHP 7.0.0. You can find out the version of PHP your server uses by going to System - System Information - PHP Information, from the top of the page.

While you are still on the same page, search for the string 'MySQL Support'. If MySQL Support is shown as enabled, go to System - Global Configuration - Server tab - Database Settings - Database Type and select 'MySQL'. This will get rid of the error.

Your web server may run PHP 7, which is recommended. In that case the PHP configuration does not have 'MySQL Support' as an option because it was removed and replaced with the improved version 'MySQLi Support'.

All is not lost because you can make a temporary fix to the code of this third party extension. Use Notepad++ or another text editor like vi, be careful not to change anything else and make the following changes to the file /modules/mod_fade_in_fade_out_my_text/tmpl/default.php:

Before:

Code: Select all

      $title =  mysql_real_escape_string($item->title);
      $link =  mysql_real_escape_string($item->link);

After:

Code: Select all

      // $title =  mysqli_real_escape_string($item->title);
      $title   = addslashes($item->title);
      // $link =  mysqli_real_escape_string($item->link);
      $link   = addslashes($item->link);

This workaround should allows you to use the module in the short term, but you should also report its incompatibility with PHP 7 to the developer.
Toivo Talikka, Global Moderator
my first programs were assembled and run in 16KB :)
http://archive.computerhistory.org/resources/text/GE/GE.GE-115SystemSoftware.1967.102646096.pdf#zoom=100

User avatar
leolam
Joomla! Master
Joomla! Master
Posts: 18032
Joined: Mon Aug 29, 2005 10:17 am
Location: Netherlands/ UK/ S'pore/Jakarta/ North America
Contact:

Re: Error: 0 Call to undefined function mysql_real_escape_string()

Postby leolam » Wed Aug 09, 2017 4:47 am

@Toivo: Nice one!

Leo 8)
Get Professional Joomla Support Services
- Joomla Professional Support:https://gws-desk.com -
- Joomla Specialized Hosting Solutions:https://gws-host.com -
- Member Joomla Bug Squad & J-CMS Release Team

sylwekb
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 118
Joined: Mon Mar 14, 2011 5:08 pm

Re: Error: 0 Call to undefined function mysql_real_escape_string()

Postby sylwekb » Wed Aug 09, 2017 6:45 am

Thanks ! Perfect !


Return to “Extensions for Joomla! 3.x”

Who is online

Users browsing this forum: Scottyman and 21 guests