Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

PHP how to insert into MySQL database

40.7K views on YouTube

#PHP #course #tutorial

include(“database.php”);

$username = “Patrick”;
$password = “rock3”;
$hash = password_hash($password, PASSWORD_DEFAULT);

$sql = “INSERT INTO users (user, password)
VALUES (‘$username’, ‘$hash’)”;

try{
mysqli_query($conn, $sql);
echo”User is now registered”;
}
catch(mysqli_sql_exception){
echo”Could not register user”;
}

mysqli_close($conn);