Page 1 sur 1

Repeat region

Posté : 17 mai 2010, 13:49
par Andrej
Helo
I have two table:
COMPANY and AGENDA
Example Tbl COMPANY
COMPANY_ID
RAISONSOCIALE
Tbl AGENDA
AGENDA_ID
COMPANY_ID
Date_evenement
Titre

So I want display repeat region sommething like this:
---------------------------------------------------------------------------------------------
RAISONSOCIALE , Company_id 1
Agenda.Date, Agenda.titre ( all records by company_id 1 )
RAISONSOCIALE , Company_id 2
Agenda.Date, Agenda.titre ( all records by company_id 2 )

Thanks in advance

Andrej

Re: Repeat region

Posté : 18 mai 2010, 22:25
par zeus
Hello.

Welcome to PHPFrance's forums.
I must warn you that we are a french forum, and you may not have many answers to an english question, and you can certainly find more appropriate english forums on the net.

Wishing you good luck.

Re: Repeat region

Posté : 18 mai 2010, 22:48
par Calimero
Hello Andrej,

What do you need in order to do that ? Pure SQL or PHP code ? And what RDBMS are you using ?

In theory, the difficult part is getting this recordset from the database, that can be done quite easily with a simple joined query between the two tables through the COMPANY_ID common field (Primary key on the first table, Foreign key on the other one).

Something like that should do it :
SELECT * 
FROM COMPANY, AGENDA 
WHERE COMPANY.COMPANY_ID = AGENDA.COMPANY_ID
The php part is pretty straightforward really, and you can find good examples of it on any decent PHP resource available on the web, including the must-read php manual : http://php.net/mysql_query . (We could link you to several good resources to learn from though, but they'd all be written in french !).

Hope this helps. Please consider learning french if you intend to post on this forum in the future, if you want to take full advantage of it.