Hi
I'm facing this error :

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /var/www/core/inc/config.php on line 7

I've tried to replace mysql with mysqli but I faced some errors.So I decided to return to mysql but my problem is how can I hide this error!?

Recommended Answers

All 2 Replies

how can I hide this error!?

You really should use mysqli_* or else one day in the future when you upgrade PHP, your code will just stop working, and you'll have PHP complaining that mysql_connect() doesn't exist. When functions are deprecated, it is a sign that you must begin migrating to the alternatives. I highly recommend using mysqli_* as the syntax is pretty much the same as mysql_*.

If you still insist to use mysql_*, then you can tell PHP not to report the use of deprecated functions. Look through /etc/php/php.ini and search for error_reporting. Append & ~E_DEPRECATED to it. For example, my PHP config has:

error_reporting = E_ALL

so I'd end up with

error_reporting = E_ALL & ~E_DEPRECATED

Hope this helps

worked thanks, Ive tried but I faced some problems with mysqli :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.