Wednesday, 15 April 2015

Is there a need to make a connection string to a database in the same PHP file if the conection is to the same database? -



Is there a need to make a connection string to a database in the same PHP file if the conection is to the same database? -

is there need create connection string database

$con = mysqli_connect('localhost' , 'root' , null , 'books');

and set charset every time after connection string that:

mysqli_set_charset($con , 'utf8');

in same php file every time want execute query?

ideally you'd want create connection 1 time , reuse same connection resource on subsequent queries database. on given "page" or "file" you'd create connection set char set reuse connection foe rest of queries on "page" or "file"

php database connection

No comments:

Post a Comment