-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgetdata.php
40 lines (35 loc) · 1005 Bytes
/
getdata.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
<?php
function getDB()
{
$dbhost="localhost";
$dbuser="root";
$dbpass="seedubuntu";
$dbname="dbtest";
// Create a DB connection
$conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error . "\n");
}
return $conn;
}
$pid = $_GET['PID'];
$pwd = $_GET['Password'];
$conn = new mysqli("localhost", "root", "seedubuntu", "dbtest");
$sql = "SELECT Name, Salary, SSN
FROM employee
WHERE pid= '$pid' and password='$pwd'";
$result = $conn->query($sql);
if ($result) {
// Print out the result
while ($row = $result->fetch_assoc()) {
printf(
"Name: %s -- Salary: %s -- SSN: %s\n",
$row["Name"],
$row["Salary"],
$row['SSN']
);
}
$result->free();
}
$conn->close();
?>