Thank you for your cooperation.
Originally, XAMPP was included, and since then, I have been using PDO.
For some reason, I uninstalled XAMPP and added Apache.
I would like to use PDO for the database relationship, so I will edit php.ini again this time and
I tried to open the DB linked page in localhost that I had already created, but
"You cannot access this web page" appears.
A page that has not been linked to DB, and
I opened a comment out of the code using DB, but
Both of them were displayed properly.
In php/ext,
php_pdo.dll, php_pdo_mysql.dll
We have also verified that there is .
PDO and pdo_mysql were also added to phpinfo().
php.ini.
extension=php_pdo.dll
extension=php_pdo_mysql.dll
Code for DB connections
$username="root";
$password="root";
$pdo = new PDO(
'mysql:host=localhost;dbname=iiidb',
$username,
$password,
array(PDO::MYSQL_ATTR_INIT_COMMAND=>"SET NAMES utf8"));
Is there anything else I should check?
Please let me know if there is anything I should try.
In the end, I would like to see a page that works with the database using PDO.
The environment is
Windows 8.1
PHP 5.2.11
Apache 2.2.14
appears.
I'd like some information, so if you notice anything,
Please let me know.
Thank you for your cooperation.
By the way,
The word "Win32" is written at the bottom of Apache Service Monitor.
I'm a little curious, but is it irrelevant...
(My PC is 64bit)
My PC was arranged by the school, and the Apache I put in this time is
It is distributed to students for use in classes by the school.
This time, a teacher let me in.
Note:
I will write down what I found out after trying it.
·I turned off the firewall, but the result was the same.
·If there is an error in the program, an error message will be displayed.
·The connection to the database has been confirmed.
·I have confirmed the execution of the DELETE statement.
·Only SELECT statements will no longer display the page.
·I have confirmed the execution of the DELETE statement.
·Only SELECT statements will no longer display the page.
try{
$pdo = new PDO(
'mysql:host=localhost;dbname=iiidb',
$username,
$password,
array(PDO::MYSQL_ATTR_INIT_COMMAND=>"SET NAMES utf8"));
// add
$pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
// select to statement
....
} catch(PDOException$e){
echo$e->getMessage();
}
Thank you for your comments and answers.
It was resolved by increasing the php version.
© 2024 OneMinuteCode. All rights reserved.