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
Post a Comment