根据url显示记录

时间:2018-04-19 13:51:45

标签: php mysql sql url

我从数据库中获取正确的记录时遇到问题。看看img。当我在电路板上单击左侧时,它会将其放入网址中。像这样https://####/boards/stel-jezelf-voor。现在我希望它只显示具有该URL的记录。

问题摘要: 我想根据网址显示记录。示例:当我按nieuws & events时,它只显示'主题'用那个网址

主题数据库

存储网址的数据库

现在的样子

<?php
  $toppic = $app->get_topics();
     foreach($toppic as $topic){
       echo '<a href="https://####/reactie"> <div id="topic">';
       echo '<div id="topicimg">';
        if(file_exists('assets/images/profielfotos/'.$topic['klant_id'])) { 
           echo '<img class="img-circle" src="/assets/images/profielfotos/'.$topic['klant_id'].'/'.$topic['foto'].'" />';
        } else {
           echo '<i class="fa fa-fw fa-user img-circle"></i>';
        }
     echo '</div><div id="topictekst">';
     echo '<b>'.$topic['topicnaam'].'</b>'; 
     echo ' - ' . $topic['voornaam'] . " " . $topic['achternaam'] ;
     echo '<span style="float:right; margin-top:15px; margin-left:5px;">'.implode($app->count_reactie($topic['id'])) .' reacties</span> <span style="float:right; color:lightgrey; margin-top:15px"class="fa fa-comment"></span>';
      echo '<hr><span class="badge bg-red">' . implode($app->boards($topic['board_id'])) . '</span>';
      echo ' laatste reactie: ' .$app->tijd_reactie($topic['id']) . ' door ' .$app->reactieDoor($topic['id']);
      echo '</div></div></a>';
    }
?>

功能:

public function get_topics(){
        $getTopic = $this->database->query("
        SELECT topics.*, klanten.foto, klanten.voornaam, boards.topic, ledenpagina.ledenpagina_id, klanten.achternaam FROM topics 
        LEFT JOIN ledenpagina ON ledenpagina.ledenpagina_id = topics.ledenpagina_id
        LEFT JOIN klanten ON topics.klant_id=klanten.id
        LEFT JOIN boards ON topics.board_id=boards.id
        WHERE ledenpagina.ledenpagina_id=:ledenpagina_id 
        ORDER BY id ASC");
        $this->database->bind(":ledenpagina_id", $_SESSION['ledenpagina_id']);

        $topics = $this->database->resultset();

        return $topics;

    }

我希望这是足够的信息,所以有人可以帮助我,这是我的第一个问题,所以不要对我说话,告诉我,如果我错过了什么。

0 个答案:

没有答案