So in my database "project" i have tables courses,courses2,courses and participants,participants2,participants3 and company.
On page company.php i have a print link where he send me on a page named print.php ,where i can see the participants.
Now on print.php i can see only participants from courses and participants ,i want to see from all tables the participants and courses ,so i need a JOIN table or UNION.
The green is participants and red is the course where he joined to participate.
http://b.imagehost.org/0199/Untitled_Document_1289728620419.png
This is my php code from print.php/
PHP CODE:
code:
<? $select_cursuri=mysql_query('select * from cursuri');
if (isset($id))
{
$select_cursuri=mysql_query('select * from cursuri where id_curs = '. $id );
}
while ($curs=mysql_fetch_array($select_cursuri)) {
$id_curs=$curs['id_curs'];
$select_participanti=mysql_query('select * from participanti where id_firma=' . $id_firma . ' and id_curs=' . $id_curs);
if (mysql_num_rows($select_participanti)!=0) {
?>
<? while ($participant=mysql_fetch_array($select_participanti)) { ?>
<tr>
<td> </td>
<td width="12%" class="style24"><? echo $participant['nume']; ?></td>
<td width="17%" class="style24"><? echo $participant['prenume']; ?></td>
<td width="17%" class="style24"><? echo $participant['functie']; ?></td>
<td width="18%" class="style24"><? echo $participant['mobil']; ?></td>
<td class="style24"><? echo $participant['hotel']; ?></td>
<td class="style24"><? echo $participant['plata'] ?></td>
<td class="style24"><? echo $participant['discount']; ?></td>
<td> </td>
</tr>
<? } } } ?>