Connections to mySQL

Codes here !

Moderators: egami, macek, gesf

Post Reply
User avatar
New php-forum User
New php-forum User
Posts: 32
Joined: Sat Feb 15, 2003 10:00 pm
Location: Los Angeles, CA

Mon Feb 17, 2003 9:28 am

If I have multiple php scripts in one page, and they all get info from my DB, do I have to connect to the DB for every script?, or can I use one connection in the first script and make my queries in the remaining scripts?

I appreciate any help.
 got gravy?

User avatar
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Mon Feb 17, 2003 12:28 pm

you can make a connection and put the connection information into a variable and reference to it when you run the other script.

Code: Select all

$db = mysql_connect($host,$user,$pass);

//first script

//second script
mysql_query($query, $db);

Post Reply