You'll need PHP to make connection inside connection.php file
<?php $conn= mysqli_connect("localhost","ID","Password","Database_name");
Then in each file you put
require('connection.php');
and there is no way than that for making a connection to MySQL database.Set queries as functions and send the thing you want to search for as a variable.
Use $_Session or $_Cookie once the user enter his email/password.
HowTo: Connect to MySQL from PHP Using Different Files
-
11-03-2022 - |
質問
Ok so I did a search to see if there other posts that explain this completely...
Well i'm here now :)
SCENARIO:
- I want to connect to your mysql database via html.
- I DO NOT want to set the parameters explicitly everytime I wish to perform a query
- I have multiple users and (ofcourse) you want their login details available throughout the application
解決
所属していません StackOverflow