CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 $db->query in Global Functions

Print topic Send  topic

Author Message
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?

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.