mysqli Connecting to the database

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!


Connect to the database to change/read/update/delete data!


  1. mysqli_connect("server", "user", "password", "database name");


1Server host e.g. "localhost" or ""
2Server username e.g. "root" or "redstonecoder"
3Server password e.g. "" or "l3g1t"
4Database name e.g. "website" or "forum"


As I showed in the example, I saved the connection to a variable to make it cleaner in code. Otherwise, when you want to query the database, you need to connect EACH time!

It makes the code a lot cleaner!

Got any mysqli Question?