System: Windows 10 10036
Environment: Apache2.4 + PHP 5.6.5 + mysql 5.5
Learning content: PHP connection database has mysqli MySQL
Problems that arise:
Deprecated: mysql_connect (): The MySQL extension is deprecated and would be a removed in the Future:use mysqli or PDO instead in D:\wamp\www\0316\phpdev_connect.php on line8
Workaround:
One
Disable PHP Error:
Display_errors = On
Switch
Display_error = Off
Two
Add in the code:
Error_reporting (E_all ^e_deprecated);
Three
Hod to solve the warnings?
Currently mostly many MySQL connection in PHP with this construct
Mysql:
$link = mysql_connect (' localhost ', ' user ', ' password '); mysql_select_db (' dbname ', $link);
Mysqli:
$link = Mysqli_connect (' localhost ', ' user ', ' password ', ' dbname ');
To run Databae queries are also simple and nearly identical with the old-to:
Old mysql_query (' Create temporary table ' table ', $link); New Msyqli_query ($link, ' Create temporary table ' table ');
Filthy and fastest solutin:
<?php error_reportion (E_all ^e_deprecated);
2015-3-18 Learning error Problem solving--php deprecated problem