This topic is locked

View with record correlation

10/6/2006 6:10:16 AM
PHPRunner General questions
A
ainoila author

Hi,
I've a DB about ancient document. The data on every document are splitted in 8 tables; in every table the the same document is identified from the same number (nscheda = primary key).
In the view I would want to be able to see the record of the selected table and also to fastly see or to link to the correlated record on the others 8 tables.
I've thought to various solutions:

  1. in VIEW seeing in 8 lines/columns/distinguished-tables the 8 records of the 8 tables
  2. IN VIEW seeing the record and 7 links to the other 7 records (of the other 7 tables)
  3. in VIEW seeig the regord and the master table detail with the links to the othet 7 records, like in master table list (I've tried copy and paste from list view but don't work)
    Problem: i'm a very newby on php and I don't know to realize no solution. Can someone help me to realize one of this solution (if you want the easiest one to explain ! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=3543&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' /> )???
    Many thanks and sorry for my low skill on php.
    Ilaria

T
thesofa 10/6/2006

Hi and welcome

Is the database MYSQL?

If so, I may be able to help

A
ainoila author 10/6/2006

Hi and welcome

Is the database MYSQL?

If so, I may be able to help


yes, it is! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=11636&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
(thanks!)

J
Jane 10/6/2006

Hi,
you can create view joined all info from 8 tables on the Datasource tables tab.

Then edit SQL query of this view on the Edit SQL query tab.

Use inner join clause:

select `table1`.`field1`,

`table2`.`field2`,

`table3`.`field3`,

...

`table8`.`field8`

from `table1` inner join `table2` on (`table1`.`nscheda` = `table2`.`nscheda`)

inner join `table3` on (`table1`.`nscheda` = `table3`.`nscheda`)

...

inner join `table8` on (`table1`.`nscheda` = `table8`.`nscheda`)


Here is more info about inner join clause:

http://webcheatsheet.com/sql/interactive_s...al/sql_join.php

http://www.w3schools.com/sql/sql_join.asp

A
ainoila author 10/10/2006

Hi Jane,
unfortunately I don't understand.

I'm historical, not a computer science people or an engineer (perhaps if I knew php and mysql I would have acquired phprunner <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=11739&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' /> ).
You can explain to me step by step what I must make?
In "Datasource tables" I must create one new "view" and then edit it in Edit SQL query
I do not understand what are field1... field8. In all the tables I don't have 8 fields...
I apologise for my hardness to understand.
Thanks
Ilaria

Alexey admin 10/10/2006

Ilaria,
you can post all your tables structures here and describe how do you want to combine them.

Then we'll try to help you to do this.

A
ainoila author 10/11/2006

Hi Alexey,
thanks for your interest.
The tables structures are (if you want I can send to you the mysql DB empty):
table "archivi"

"nscheda";

"ist_cons";"den_fondo1";"den_fondo2";"den_fondo3";"den_fondo4";"den_fondo5";"u_const";"u_consn";"u_archt";"u_archn";"su_archt";"su_archn";"carte";"cons";"data_in";"sec_in";"spsec_in";"data_end";"sec_end";"spsec_end"
table " tribunale"

"nscheda";

"org_giud";"sede_org_giudic";"giud_cogn_nome";"giud_carica";"cancel";"proc_part_at";"proc_par_comp";"proced_uff";"class";"cl_altro"
table " part_att"

"nscheda";

"att_nome";"att_cognome";"att_patro";"att_prov";"att_sex";"att_age";"att_orig";"att_resid";"att_prof";"att_nobile";"att_eccles";"att_cf"
table " part_comp"

"nscheda";

"comp_nome";"comp_cognome";"comp_patro";"comp_prov";"comp_sex";"comp_age";"comp_orig";"comp_resid";"comp_prof";"comp_nobile";"comp_eccles";"comp_cf"
table "ist_att"

"nscheda";

"ist_patt";"ist_altro";"ist_separ";"ist_anull"
table "giudizio"

"nscheda";

"grado";"sede_pg";"data_pgsen";"sentenza_pg";"sentenza_altro";"giud_sep";"giud_anull"
table " sentenza"

"nscheda";

"sino";"data_plsen";"sen";"sen_altro";"sen_separ";"sen_anull"
table "note"

"nscheda";

"cit_dot";"data_app";"accordo";"parte_appel";"documenti";"note";"compilatore";"data_comp"
nscheda is the primary master key.
It would to arrange (if it is possible) the "View tabs" like in picture.

To have links to the "view tab" of same one record (nscheda) in the other tables (in the picture, the links are in red to the bottom of the page)

As an example: the link would have to jump to View numero scheda (= nscheda) 10 of table "tribunale" or the to View of same one record in table "parte attrice", etc.
views with links
Or, if it is simpler, in every "view" to put all informations about the record (as an example View numero scheda (= nscheda) 10) arranged in rows or columns (one for each table). Look this example:
view with all information in tables
Phprunner is fantastic and it has already resolved many problems.

I hope to resolve also this problem that is a lot important for me.
Many many tahanks

Ilaria

J
Jane 10/12/2006

Ilaria,
to create view with links to other tables proceed to the events tab, select ViewOnLoad event and add your code in it.

Here is a sample code:

function ViewOnLoad()

{

echo "<a href=\"tribunale_view.php?".$_SERVER["QUERY_STRING"]."\">tribunale</a>
";

echo "<a href=\"part_att_view.php?".$_SERVER["QUERY_STRING"]."\">part_att</a>
";

echo "<a href=\"part_comp_view.php?".$_SERVER["QUERY_STRING"]."\">part_comp</a>
";

echo "<a href=\"giudizio_view.php?".$_SERVER["QUERY_STRING"]."\">giudizio</a>
";

echo "<a href=\"ist_att_view.php?".$_SERVER["QUERY_STRING"]."\">ist_att_view</a>
";

echo "<a href=\"sentenza_view.php?".$_SERVER["QUERY_STRING"]."\">sentenza</a>
";

echo "<a href=\"note_view.php?".$_SERVER["QUERY_STRING"]."\">note</a>
";

}



Then rebuild your pages.

A
ainoila author 10/12/2006

GREAT!!!
It works <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=11796&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
many many many thanks Jane!!!! (for you patience too)