質問編集履歴
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -33,6 +33,8 @@
|
|
33
33
|
$pass='mysql';
|
34
34
|
$dbh = new PDO($dsn, $user, $pass);
|
35
35
|
```
|
36
|
-
データベースはxampp内のMySQLで作成しており、PDOで接続し、vscodeでそのデータ
|
36
|
+
データベースはxampp内のMySQLで作成しており、PDOで接続し、vscodeでそのデータを取得したいです。
|
37
37
|
|
38
38
|
![コンパネ](https://ddjkaamml8q8x.cloudfront.net/questions/2022-01-27/eb436536-33fa-4faf-9d2c-69fdd73d2290.png)
|
39
|
+
|
40
|
+
システムの環境変数にC:\xampp\phpを追加したのみです。
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -25,3 +25,14 @@
|
|
25
25
|
Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2002] 対象のコンピューターによって拒否されたため、接続できませんでした。
|
26
26
|
```
|
27
27
|
|
28
|
+
### 修正
|
29
|
+
|
30
|
+
```php
|
31
|
+
$dsn = 'mysql:dbname=item;host=localhost';
|
32
|
+
$user='root';
|
33
|
+
$pass='mysql';
|
34
|
+
$dbh = new PDO($dsn, $user, $pass);
|
35
|
+
```
|
36
|
+
データベースはxampp内のMySQLで作成しており、PDOで接続し、vscodeでそのデータえ取得したいです。
|
37
|
+
|
38
|
+
![コンパネ](https://ddjkaamml8q8x.cloudfront.net/questions/2022-01-27/eb436536-33fa-4faf-9d2c-69fdd73d2290.png)
|