What is the proper way to reference a table from another module? For example, from within the NMS module, how would I properly reference the FEU propdefn table?
I guess the following could potentially lead to problems:
SELECT * FROM ".cms_db_prefix()."module_feusers_propdefn ORDER BY prompt
I can't imagine that module table names get changed that often, certainly not by normal installs.
Tim
Proper way to reference tables of other modules?
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Proper way to reference tables of other modules?
That'll work, as it's in the same database.
But with FEU, the preferred method would be to use the functions in FrontendUsers.ap.php
i.e:
$feu = $this->GetModuleInstance('FrontEndUsers');
$propdefn = $feu->GetPropertyDefn('PropertyName');
But with FEU, the preferred method would be to use the functions in FrontendUsers.ap.php
i.e:
$feu = $this->GetModuleInstance('FrontEndUsers');
$propdefn = $feu->GetPropertyDefn('PropertyName');
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Proper way to reference tables of other modules?
Thanks. In this case, I want to get a list of field values in the name column from the FEU propdefn table. So, I don't necessarily know which 'PropertyName' to use. Perhaps I should have been more specific with my query example. I'm using:
SELECT name, prompt FROM ".cms_db_prefix()."module_feusers_propdefn where type = 0 ORDER BY prompt
Sounds like I can just use the table's name directly without too much trouble.
Thanks,
Tim
SELECT name, prompt FROM ".cms_db_prefix()."module_feusers_propdefn where type = 0 ORDER BY prompt
Sounds like I can just use the table's name directly without too much trouble.
Thanks,
Tim