// Establish a database connection $conn = mysqli_connect('localhost', 'username', 'password', 'database_name'); // Select query to check for user exists $query = "SELECT * FROM users WHERE username = 'testuser'"; // Execute the query $result = mysqli_query($conn, $query); // Check for number of rows returned if(mysqli_num_rows($result) > 0) { echo "User exists!"; } else { echo "User does not exist!"; }In the above example, we are first establishing a database connection using the mysqli_connect function. We then execute a select query to check for the existence of a particular user. The mysqli_query function returns a result set which is checked for the number of rows returned using the mysqli_num_rows function. Finally, we print out a message based on the number of rows returned. The mysqli_num_rows function belongs to the MySQL Improved Extension in PHP, which is a package library used to interact with MySQL databases.