Jump to content

[SOLVED] Best Practice


Andy-H

Recommended Posts

I guess the best practise would be to have your connect to the database password behind your DNS wall.

 

<?php # connect.php

DEFINE ('DB_USER', 'username');
DEFINE ('DB_PASSWORD', 'yourpassword');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', databasename);

$connect = @mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die ('Could not connect to MySQL: ' . mysqli_connect_error());

?>

 

The in your main DNS page use

<?php
require_once('../connect.php')

$what = "SELECT * bla bla bla";
$query = mysqli_query($connect, $what);

// dont forget to close connection!
mysqli_close($connect);
?>

Link to comment
https://forums.phpfreaks.com/topic/118366-solved-best-practice/#findComment-610804
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.