-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb_result.php
44 lines (43 loc) · 1.27 KB
/
db_result.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
<!DOCTYPE html>
<html lang="EN">
<head>
<link rel="stylesheet" type="text/css" href="format.css">
<meta charset="UTF-8">
<title>Database Result</title>
</head>
<body>
<h1>SQL Command Results</h1>
<?php
$mServername = "localhost";
$mUsername = "root";
$mPassword = "";
$mDatabase = "kaufwunder_online";
@$mConnection = new mysqli($mServername, $mUsername, $mPassword, $mDatabase);
if ($mConnection->connect_error) {
die("Connection failed: " . $mConnection->connect_error);
}
else {
echo "Connection successful! <br><br><br>";
$mCommand = $_POST['tfCommand'];
$mResult = $mConnection->query("$mCommand");
if (!$mResult or $mResult->num_rows == 0) {
die("Data retrieval failed: " . $mConnection->error . "!<br><br><br>Connection closed!");
}
else {
while ($mRow = $mResult->fetch_object()) {
foreach ($mRow as $mColumnName => $mColumnData) {
echo $mColumnName . ": " . $mColumnData . "<br>";
}
}
}
$mResult->close();
$mConnection->close();
echo "<br><br> Connection closed!";
}
?>
<footer>
© 2021-<script>document.write(new Date().getFullYear())</script> mexikoedi<br><br>
All rights reserved.
</footer>
</body>
</html>