Mysql Error

How to Solve MySQL extension is deprecated?

Google+ Pinterest LinkedIn Tumblr

How To Slove the Mysql extension is Deprecated ? and What is Deprecated Error?

After PHP5 version updated mysql_connect() is updated with Mysqi_Connect().

if you used old version of MYSQL_CONNECT() for database it shows Deprecated Error
For Example

CODE FOR CONNECT in old version

<?php
$link = mysql_connect('localhost', 'user', 'password');
mysql_select_db('databasename', $link);
?>

CODE FOR CONNECT in new version

<?php 
$link = mysqli_connect('localhost', 'user', 'password', 'databasename');
?>

Its look all database name also in same fields
Query:

<?php
In Old  mysql_query('CREATE TABLE `table`', $link); 
In New  mysqli_query($link, 'CREATE TABLE `table`');
?>


Fast and Easy Solution
Suppress all deprecated warnings including them from mysql_*:

<?php
error_reporting(E_ALL ^ E_DEPRECATED);
?>

Insert this code in the top of the php page.
If you have further questions: Just left them below in the comments
Enjoy Easy Coding

I'm Rajasekar - Web developer, Freelancer, Blogger and Owner of DeveloperDesks. From India lives in Bahrain. I love to do coding, Creating websites and trying different with code and designs. You Can Hire Me