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