Karen
|
Posted: 01/08/2002, 4:47 AM |
|
I just need to confirm if it's correct that $db->query cannot be used in global functions. This is becoz I get a fatal error but using dLookUp is ok.
|
|
|
Nicole
|
Posted: 01/08/2002, 5:29 AM |
|
Karen,
you can use the instance of DB_Sql class and its methods under Global functions section. But the instance should have the name different to "db" in order not to duplicate names. Use e.g. "db_my". As you create new instance you should open new connection to db, that's why the beginning of your function should be like:
global $db;
$db_my = new DB_Sql();
$db_my->Database = $db->Database;
$db_my->User = $db->User;
$db_my->Password = $db->Password;
$db_my->Host = $db->Host;
$sql = "<your_query>";
$db_my->query($sql);
|
|
|
Karen
|
Posted: 01/09/2002, 5:05 PM |
|
Thanx, Nicole. It works fine. But I also noticed that if I just declare global $db, I can also use $db->query without any problems. Can I just use that instead of a new instance?
|
|
|
|