mysql - require pdo connection to database 2 questions -


i have 2 questions, 1 security.

so have problem calling database connection. have use database connection menu check session , change menu if user logged in. problem if want make profile page need recall database connection. call database connection 2 times. scheme:

profile.php -> require("databaseconnection.php"); menu.php -> require("databaseconnection.php"); 

my guess that, should make 2nd db connection or can call @ head.php include every page. example:

$db = new pdo("mysql:host={$host};dbname={$dbname};charset=utf8", $username, $password, $options); $db2 = new pdo("mysql:host={$host};dbname={$dbname};charset=utf8", $username, $password, $options); 

or safe call head.php have included every page?

you can call @ head.php include every page.

there no point in creating 2 connections, unless want increase server load.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -