Your Location is: Home > Php

inner join for two tables with foreign key

From: Afghanistan View: 1892 Erikas Masaitis 


what im trying to do is something like this:

enter image description here

i have sql:

$kursantai = "kursantai";
$seminaras = "seminaras";
$sql = "SELECT `{$this->kursantai}`.`vardas`,
                 FROM `{$this->seminaras}`
        INNER JOIN `{$this->$kursantai}`
        ON `{$this->$kursantai}`.`seminaro_nr` = `{$this->seminaras}`.`sem_id`
        ORDER BY `{$this->seminaras}`.`pavadinimas`";

how can i print my sql results in a way that is shown in picture?

Best answer