What are some best practices for building a website using only PHP/HTML/CSS/MYSQL and avoiding the use of Java?

One way to build a website using only PHP/HTML/CSS/MYSQL and avoid the use of Java is to focus on server-side scripting with PHP to handle dynamic content generation and database interactions. By utilizing PHP to process form submissions, retrieve data from a MYSQL database, and generate HTML content, you can create a fully functional website without the need for Java.

<?php
// Connect to MYSQL database
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";

$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}

// Retrieve data from MYSQL database
$sql = "SELECT id, name, email FROM users";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
  // Output data of each row
  while($row = $result->fetch_assoc()) {
    echo "id: " . $row["id"]. " - Name: " . $row["name"]. " - Email: " . $row["email"]. "<br>";
  }
} else {
  echo "0 results";
}

$conn->close();
?>