Greetings, I am writing a module that needs the user's id from the pnuser table. I would like to create a foreign key for my tables but I would need to know the proper way to get the pnuser table name that accounts for changes in table prefix and so on. Essentially I need the pntables result for the user module. How do I get that ?
I would look it up on the API reference but that seems to have VANISHED! :(
TIA.
- craigh responded to »TagIt 3.0 for Zikula« 03:58 PM
- jmvaughn responded to »error when i try to upgrade to the last version of dizkus module (3.1)« 12:05 PM
- localrags responded to »Remove contents of nuke_sc_anticracker from Database« 11:30 AM
- jmvaughn responded to »Shoutit for zikula 1.3?« 09:31 AM
- mdee responded to »Different page content under one template (tpl file) based on URL« 07:17 AM
- espaan responded to »Categories disappear when editing ...« 08. Feb
- eledril responded to »How decrease zikula cpu usage« 08. Feb
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
What is the proper way to Foreign Key?
-
**unknown user**
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 1097
In 762... using
Code
$pntable = pnDBGetTables();
Will get you the user table information
Code
$usertbl = $pntable['users'];
$usercol = $pntable['users_column'];
In 0.8, you'll need a
Code
pnModDBInfoLoad('Users');
The users table will then be available the same way.
As you said, having your table name hardcoded is bad, if you are building a module, you should have a pntables.php.
- Moderated by:
- Support
Users on-line
- 0 users
This list is based on users active over the last 60 minutes.
