To connect to MySQL using PHP, you can use the mysqli or PDO extension. Here's an example using mysqli:
main.php314 chars14 lines
In this example, replace localhost with your MySQL server name, username and password with your MySQL username and password, myDB with your database name.
Note that you should never store your MySQL credentials in plain text in your PHP code. It's a good practice to keep them in a separate configuration file and load them securely.
gistlibby LogSnag