Domanda

Ok so I did a search to see if there other posts that explain this completely...

Well i'm here now :)


SCENARIO:

  1. I want to connect to your mysql database via html.
  2. I DO NOT want to set the parameters explicitly everytime I wish to perform a query
  3. I have multiple users and (ofcourse) you want their login details available throughout the application

È stato utile?

Soluzione

  1. 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.

  2. Set queries as functions and send the thing you want to search for as a variable.

  3. Use $_Session or $_Cookie once the user enter his email/password.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top