Is it possible to create an ADO connection that will stay global within all of my functions? Or will i need to setup the connection in all of the functions?
Thanks,
timbiotic
Database Connection Global
Moderator: General Moderators
- coolpravin
- Forum Newbie
- Posts: 20
- Joined: Mon May 19, 2003 12:56 am
- Location: India
Make a seperate file
Make a seperate file for connection.
Here define the connection variables and connect to database.
You can do this in config file also.
THen include this file in each of your coding file and you will get the connection.
For functions , inside function just define the connection variable as global
And all of your work will be done.
Here define the connection variables and connect to database.
You can do this in config file also.
THen include this file in each of your coding file and you will get the connection.
For functions , inside function just define the connection variable as global
Code: Select all
e.g function findusers()
{
Global $db;
//function code
}THANK YOU!!!
Another Question
Since switching to ADO i have had to adjust to non ODBC calls. What is the equivalent of odbc_fetch_row?
I can't seem to get the syntax right with ADO:
Former
Code that wont work now:
Any ideas what i am doing wrong?
Thanks,
timbiotic
I can't seem to get the syntax right with ADO:
Former
Code: Select all
while($row = odbc_fetch_row($sql_results))
{ //process stuff }Code: Select all
while($row = $sql_results-> FetchRow())
{ //process stuff }Thanks,
timbiotic