I used php7 and mysql in Windows 7. When I enabled mysql extension, I found that only php_pdo_mysql and php_mysqli in ext. The mysql _ * function is not found at the same time. For more information, see mysqlnd driver. Is mysqlnd installed? Then how can I use it. Thank you.
I used php7 and mysql in Windows 7. When I enabled mysql extension, I found that only php_pdo_mysql and php_mysqli in ext. The mysql _ * function is not found at the same time. For more information, see mysqlnd driver.
Is mysqlnd installed? Then how can I use it. Thank you.
Reply content:
I used php7 and mysql in Windows 7. When I enabled mysql extension, I found that only php_pdo_mysql and php_mysqli in ext. The mysql _ * function is not found at the same time. For more information, see mysqlnd driver.
Is mysqlnd installed? Then how can I use it. Thank you.
First, correct a problem,
Starting from 5.x, PHP connects to MYSQL by using the mysqlnd Driver (of course, when you install it ). Includingmysql_*
,PDO_MYSQL
,MYSQLi
--with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
Instead--with-mysqli=/usr/local/mysql
mysqlnd
Andmysql
mysqli
pdo_mysql
Link analogymysqlnd
YesMetal
, Andmysql
mysqli
pdo_mysql
JustMetal Products
Only
Use PDO to connect to mysql
$ Pdo = new PDO ('mysql: host = localhost; dbname = database_name; port = 000000', 'username', 'Password '); $ pdo-> exec ('set names utf8'); $ stmt = $ pdo-> prepare ("select * from table where id =: id "); $ stmt-> bindValue (': id', 1, PDO: PARAM_INT); $ stmt-> execute (); $ rows = $ stmt-> fetchAll (PDO :: FETCH_ASSOC); $ rows = $ pdo-> query ("select * from table where id = 1")-> fetchAll (PDO: FETCH_ASSOC );
Mysql extension in php7 is completely removed. For better backward compatibility, use PDO;
You have been installed. You can refer to the Manual to connect to the database with PDO.
Please use PDO more. There is an object-oriented idea in it for better use.
I didn't want to answer this question .... Just wondering how to replace mysql in the old project with pdo .... You deserve it, PDO.