I am getting this warning, but the program still runs correctly.
The MySQL code is showing me a message in PHP:
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\xampp\htdocs\task\media\new\connect.inc.php on line 2
My connect.inc.php
page is
<?php
$connect = mysql_connect('localhost','root','');
mysql_select_db('dbname');
?>
What does this mean and how can I eliminate the message?
This will solve your problem.
To suppress the deprecation message for this alone (and stay informed of other deprecations in your code) you can prefix the connect with @:
PDO class replaces these methods. Example for Mysql or MariaDB :
Source : PDO Class
You can remove the warning by adding a '@' before the mysql_connect.
but as the warning is telling you, use mysqli or PDO since the mysql extension will be removed in the future.
That is because you are using PHP 5.5 or your webserver would have been upgraded to 5.5.0.
The
mysql_*
functions has been deprecated as of 5.5.0Source
Its just a warning that is telling you to start using newer methods of connecting to your db such as pdo objects
http://code.tutsplus.com/tutorials/php-database-access-are-you-doing-it-correctly--net-25338
The manual is here
http://www.php.net/manual/en/book.pdo.php