-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
38 lines (30 loc) · 911 Bytes
/
index.php
File metadata and controls
38 lines (30 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/*----------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
*---------------------------------------------------------------------------------------*/
function sayHello($name) {
echo "Hello $name!";
}
function connect() {
$db = new PDO('mysql:host=vscode-remote-try-php_devcontainer_db_1;dbname=database', 'admin', 'test');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$databaseTest = ($db->query('SELECT * FROM dockerSample'));
foreach($databaseTest->fetchAll(PDO::FETCH_OBJ) as $row)
{
echo "$row->name";
}
}
?>
<html>
<head>
<title>Visual Studio Code Remote :: PHP</title>
</head>
<body>
<?php
sayHello('remote world');
connect();
phpinfo();
?>
</body>
</html>