-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
36 lines (29 loc) · 832 Bytes
/
test.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
<?php
//Database connection information
$dbHost = "localhost";
$dbUsername = "root";
$dbPassword = "usbw";
$dbName = "steven_db";
//Try to connect to the database
$conn = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName);
// Check connection
if($conn->connect_error){
die("Database connection failed: " . $conn->connect_error);
} else {
echo "Database connection successful.<br>";
}
//User email to check
$testEmail = '[email protected]';
// Prepare SQL query
$query = "SELECT * FROM users WHERE email = '" . $conn->real_escape_string($testEmail) . "'";
//Execute query
$result = $conn->query($query);
// Check query results
if($result->num_rows > 0){
echo "Find matching users:" . $testEmail;
} else {
echo "No matching user found:" . $testEmail;
}
//Close database connection
$conn->close();
?>