2015-3-18 Learning error Problem solving--php deprecated problem

Source: Internet
Author: User
Tags php error

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.