What are some recommended PHP books for beginners looking to learn PHP5 and database connectivity?

For beginners looking to learn PHP5 and database connectivity, some recommended books include "PHP and MySQL for Dynamic Web Sites" by Larry Ullman, "PHP and MySQL Web Development" by Luke Welling and Laura Thomson, and "Learning PHP, MySQL & JavaScript" by Robin Nixon. These books provide comprehensive coverage of PHP programming basics, database connectivity, and practical examples to help beginners understand and apply PHP concepts effectively.

<?php
// Sample PHP code for connecting to a MySQL database
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database_name";

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

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