Skip to content

Instantly share code, notes, and snippets.

@maxixo
Created January 20, 2026 14:15
Show Gist options
  • Select an option

  • Save maxixo/2d77e3780af9e291e1c515a28a420efd to your computer and use it in GitHub Desktop.

Select an option

Save maxixo/2d77e3780af9e291e1c515a28a420efd to your computer and use it in GitHub Desktop.
connecting mysql to php
<?php
$host = 'localhost';
$user = 'root';
$password = "";
$dbname = "myapp";
//create connection
$conn = new mysqli($host,$user,$password,$dbname);
//check connection
if ($conn->connect_error) {
die('connection failed : ' . $conn->connect_error);
}
echo "connected successfully";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment