-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathselect_query.php
48 lines (33 loc) · 1.11 KB
/
select_query.php
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
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE HTML>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Поиск по студентам</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<?php
$servername = 'localhost'; // либо '127.0.0.1'
$username = 'admin';
$password = 'admin' ;
$db_name = 'findsale';
$opt = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
);
$firstName = "Dmitry";
$lastName = "Vlasov";
$connection = new PDO("mysql:host=$servername; dbname=$db_name; charset=utf8", $username, $password, $opt);
$result = $connection->prepare("SELECT `ID`,`ADRESS` FROM `shops`");
$result->execute([]);
if ($result){
echo"<div class='header'><div class='logo'><h1>Collage</h1></div>";
echo "</div>";
echo "<a href='index.php'><button class='back'>↩Назад</button></a>";
echo "<table class='resultTable'>";
foreach($result as $row){
echo $row['ADRESS'];
}
echo "</table>";
}
// Закрываем соединение
$pdo = NULL;
?>
</body></html>