Deprecated: mysql_connect()

Discuss coding issues, and scripts related to PHP and MySQL.
User avatar
JanMolendijk
Posts:282
Location:Holland Rotterdam

Deprecated: mysql_connect()

First thing it stay`s an great website
i learning alot & i`m thankfully.
I getting this error & ask myself what is wrong

Code: Select all

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/u790012824/public_html/Visitor-Tracker/reader.php on line 23
Line 23 starts here but what is Deprecated ?

Code: Select all

$db = mysql_connect($hostname, $username,$password);
mysql_select_db($dbname,$db);

Admin Posts:805
Hello,
Welcome to this website.
It seems you use an old php script, which uses the mysql_connect() function for working with mysql database.
That function is deprecated in the newer php versions (php 5.5+).
The solution is to use the MySQLi or PDO functions, which means to modify the code of that script to replace al the mysql_ instructions with MYSQLi or PDO.
- For more info, just search on the net for: " Deprecated: mysql_connect() ".

- On his site there are some lessons for beginners about MiSQLi and PDO, just see the PHP-MySQL Course