WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

How about one to many relations database

View: New views
5 Messages — Rating Filter:   Alert me  

How about one to many relations database

by compix :: Rate this Message:

| View Threaded | Show Only this Message

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.

Re: How about one to many relations database

by acook :: Rate this Message:

| View Threaded | Show Only this Message

You'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.

View this message in context: How about one to many relations database
Sent from the amfphp-general mailing list archive at Nabble.com.

------------------------------------------------------------------------------
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



------------------------------------------------------------------------------
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 database

by acook :: Rate this Message:

| View Threaded | Show Only this Message

Whoops, 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:

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.

View this message in context: How about one to many relations database
Sent from the amfphp-general mailing list archive at Nabble.com.

------------------------------------------------------------------------------
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




------------------------------------------------------------------------------
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 database

by acook :: Rate this Message:

| View Threaded | Show Only this Message

Missed 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:


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:

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.

View this message in context: How about one to many relations database
Sent from the amfphp-general mailing list archive at Nabble.com.

------------------------------------------------------------------------------
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





------------------------------------------------------------------------------
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

Parent Message unknown Re: [Re: How about one to many relations database] (SWP-5758501230747ef8f)

by Regis TEDONE :: Rate this Message:

| View Threaded | Show Only this Message

Bonjour, c'est Regis TEDONE.

L'adresse regis.tedone@... est protégée des courriers indésirables par SpamWars.

Pour que vos messages me soient transmis, veuillez cliquer ici.
Vous n'aurez à effectuer cette opération qu'une seule fois, et vous serez averti de l'acheminement de votre message.

Cordialement,
Regis TEDONE


SpamWars Edition Personnelle est un antispam gratuit multi-plateforme (Windows, MacOS, Unix/Linux) que vous pouvez télécharger ICI


Hello, this is Regis TEDONE.

The address regis.tedone@... is protected against spam by SpamWars.

In order to send me messages, please click here.
This needs to be done only once, and you will receive e-mail notification once your message is sent.

Best regards,
Regis TEDONE


SpamWars Personal edition is a free multi-plateform antispam product (Windows, MacOS, Unix/Linux) that you can download HERE


------------------------------------------------------------------------------
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