|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
How about one to many relations databaseHello alls...
I have a database that have many tables, I need to know how to handle this situation:
One table ( accounts ) have the fileds id,account,name, etc... , other table (contacts) have the fileds id, name, address, etc... and the other table ( account_contacts) that managed the relations between accounts and contacts table have the fileds id, account_id, contact_id, etc.
I need to show in a flash datagrid the accounts, and when I select an account in another datagrid display the contacts for this account, and when I select a contact in a datagrid the action display the details for this contact in some editable text fields to modify some of this fileds...
It's possible to do this with amfphp?
Thanks in advance for the help.
|
|
|
Re: How about one to many relations databaseYou'd want to have one method to get all of your accounts:
public function GetAccounts() { $ On Fri, Oct 9, 2009 at 7:36 PM, compix <rodolfo.vivas@...> wrote: Hello alls... I have a database that have many tables, I need to know how to handle this situation: One table ( accounts ) have the fileds id,account,name, etc... , other table (contacts) have the fileds id, name, address, etc... and the other table ( account_contacts) that managed the relations between accounts and contacts table have the fileds id, account_id, contact_id, etc. I need to show in a flash datagrid the accounts, and when I select an account in another datagrid display the contacts for this account, and when I select a contact in a datagrid the action display the details for this contact in some editable text fields to modify some of this fileds... It's possible to do this with amfphp? Thanks in advance for the help. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ amfphp-general mailing list amfphp-general@... https://lists.sourceforge.net/lists/listinfo/amfphp-general |
|
|
Re: How about one to many relations databaseWhoops, sorry:
You'd want to have one method to get all of your accounts: public function GetAccounts() { $q = $this->escape ("SELECT * FROM accounts"); // maybe add some other conditions... return $this->DB->_query ($q); } public function GetContactsForAccount ($AccountID) { $q = $this->escape ("SELECT * FROM contacts WHERE account_id = %d", $AccountID ); return $this->DB->_query ($q); } In Flash/Flex you'd call GetAccounts to load your first DataGrid/List, then when the user clicks a certain row, you'd call GetContactsForAccount, passing the id/row they clicked on... You might want to check out the tutorials on the site. They are dated, because they're from amfphp 1.2, but they still give you a good idea of how amfphp works. Alex On Fri, Oct 9, 2009 at 7:47 PM, Alex Cook <cook@...> wrote: You'd want to have one method to get all of your accounts: ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ amfphp-general mailing list amfphp-general@... https://lists.sourceforge.net/lists/listinfo/amfphp-general |
|
|
Re: How about one to many relations databaseMissed that last part. When the user clicks the second datagrid, you'd want to call some function like GetContactDetails ($ContactID), which will return to you the current data for the contact (Name, Email, Phone, etc...).
You'd then display that data in some ui - InputText, etc... When the user saves the data, you'd have a method such as SetContactDetails($ContactID, $First, $Last, $Etc, $Etc) which would run a query like UPDATE contacts SET firstname = $First, lastname = $Last WHERE id = $ContactID. Hopefully this gets you started, it's psuedo code so it might not make sense. Let me know. Alex On Fri, Oct 9, 2009 at 7:50 PM, Alex Cook <cook@...> wrote: Whoops, sorry: ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ amfphp-general mailing list amfphp-general@... https://lists.sourceforge.net/lists/listinfo/amfphp-general |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |