Connections to mySQL

Codes here !

Moderators: egami, macek, gesf

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

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.
-DigitalGravy
 got gravy?
 http://www.digitalgravy.net

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

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

<?php
$db = mysql_connect($host,$user,$pass);


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

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

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests