Is it usually MySQL or mysqli?

Source: Internet
Author: User
Why do you have mysqli?


Reply to discussion (solution)

New versions of PHP are deprecated Mysql_ series functions, it is obviously recommended to use MYSQLI.

Mysqli is object-oriented, and of course it can be process-oriented
Object oriented

$mysqli =new mysqli ("localhost", "root", "123456", "test"), if ($mysqli->connect_error) {die ("Connection failed". $mysqli Conect_error);} $sql = "SELECT * from user1", $res = $mysqli->query ($sql), while ($row = $res->fetch_row ()) {foreach ($row as $k + = $v) {echo "-$v";} echo "
";} $res->free (); $mysqli->close ();

Process oriented
$mysqli =mysqli_connect ("localhost", "root", "123456", "test"), if (! $mysqli) {die ("Connection Failed". Mysqli_connect_error ($ mysqli));} $sql = "SELECT * from user1", $res =mysqli_query ($mysqli, $sql) and while ($row =mysqli_fetch_row ($res)) {foreach ($row as $k = > $v) {echo "-$v";} echo "
";} Mysqli_free_result ($res); Mysqli_close ($MYSQLI);

Preferred PDO
Next mysqli

Preferred PDO
Next mysqli



Is PDO just PDBC?

Mysqli is object-oriented, and of course it can be process-oriented
Object oriented

$mysqli =new mysqli ("localhost", "root", "123456", "test"), if ($mysqli->connect_error) {die ("Connection failed". $mysqli Conect_error);} $sql = "SELECT * from user1", $res = $mysqli->query ($sql), while ($row = $res->fetch_row ()) {foreach ($row as $k + = $v) {echo "-$v";} echo "
";} $res->free (); $mysqli->close ();

Process oriented
$mysqli =mysqli_connect ("localhost", "root", "123456", "test"), if (! $mysqli) {die ("Connection Failed". Mysqli_connect_error ($ mysqli));} $sql = "SELECT * from user1", $res =mysqli_query ($mysqli, $sql) and while ($row =mysqli_fetch_row ($res)) {foreach ($row as $k = > $v) {echo "-$v";} echo "
";} Mysqli_free_result ($res); Mysqli_close ($MYSQLI);



Object-oriented can not be determined without

PHP Data Objects (PDO)
PHP built-in database abstraction layer

PHP Data Objects (PDO)
PHP built-in database abstraction layer



Is it popular with ODBC under PHP?

Is ODBC also used in Linux?

Is ODBC also used in Linux?



Yes, but SQL Server, pdo_sqlsrv and PDO_ODBC should use which Ah, it is estimated that the ODBC performance is strong

Pdo_sqlsrv

ODBC is a universal interface that ignores the personality characteristics of a database

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