-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b65b2f9
commit 4f56eba
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
header('Content-Type: application/json'); | ||
|
||
// Your database connection code goes here | ||
$servername = "localhost"; | ||
$username = "username"; | ||
$password = "password"; | ||
$dbname = "myDB"; | ||
|
||
$conn = new mysqli($servername, $username, $password, $dbname); | ||
|
||
if ($conn->connect_error) { | ||
die("Connection failed: " . $conn->connect_error); | ||
} | ||
|
||
$sql = "SELECT COUNT(*) as usercount FROM users"; | ||
$result = $conn->query($sql); | ||
|
||
if ($result->num_rows > 0) { | ||
$row = $result->fetch_assoc(); | ||
echo $row['usercount']; | ||
} else { | ||
echo "0"; | ||
} | ||
|
||
$conn->close(); | ||
?> |