Mysql-php the operation of the database, the use of both the process and the object of the word is the same code?

Source: Internet
Author: User
Keywords Php mysql sql
Tags php and mysql
Just combine PHP and MySQL to learn,
In advance, is the process-oriented function the same as the object-oriented function?

For example, the query function can be written as follows:
mysql_query ($sql); Method
$conn->query ($sql)//Object

Again such as the Connect_error function, can be written as follows:
Mysqli_connect_error (); Method
$conn->connect_error//process

I'm not experimenting with anything else.
I would like to ask, is not all functions mysqli_ replaced by the object name---line?

There is the operation of data, where is the habit of using the process when the use of the object?

Reply content:

Just combine PHP and MySQL to learn,
In advance, is the process-oriented function the same as the object-oriented function?

For example, the query function can be written as follows:
mysql_query ($sql); Method
$conn->query ($sql)//Object

Again such as the Connect_error function, can be written as follows:
Mysqli_connect_error (); Method
$conn->connect_error//process

I'm not experimenting with anything else.
I would like to ask, is not all functions mysqli_ replaced by the object name---line?

There is the operation of data, where is the habit of using the process when the use of the object?

PHP Deprecated:mysql_connect (): The MySQL extension is Deprecated and would be a removed in the future:
The procedural wording is only supported by Php_mysql, but the PHP high version has canceled the Php_mysql support.

From the code point of view, they are the same, at the end of the same code to implement database operations, the difference is the design.

  • 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.