Skip to content

Commit

Permalink
Create php.php
Browse files Browse the repository at this point in the history
  • Loading branch information
AB3462461320878 authored Oct 22, 2023
1 parent b65b2f9 commit 4f56eba
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions php.php
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();
?>

0 comments on commit 4f56eba

Please sign in to comment.