How can PHP beginners effectively post questions on forums to get the best help?

Issue: I am trying to connect to a MySQL database using PHP but I keep getting a connection error. Code snippet:

```php
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";

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

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

By following this format, PHP beginners can effectively communicate their issue and provide the necessary information for forum members to provide the best help possible.