Jump to content

I only want to connect to database once?


pouncer

Recommended Posts

I've got this code at the to of my index.php

 

<?
require_once("database.php");
require_once("functions.php");
   
   	$db = new Database();
   	$db->Connect();
?>

 

The Connect() method is just the mysql_connect(...) stuff.

 

So everytime I refresh my index.php, is my web app always executing the mysql_connect?? is there a better way to do it so it just connects once when i open the index.php and not again and again...

Link to comment
https://forums.phpfreaks.com/topic/153307-i-only-want-to-connect-to-database-once/
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.