douli0531 2018-04-19 13:51
浏览 35

根据url显示记录

I have a problem with getting the right records out of the database. look at the img. When I click on the left on a board it will put that in the url. Like this https://####/boards/stel-jezelf-voor. Now I want it to display only the records that have that url.

The question summary: I want to display the records based on the url. Example: When I press nieuws & events and it will only display the 'topics' with that url

the topic database

The database where the url's are stored

How it look now

<?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>';
    }
?>

The function:

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;

    }

I hope that this is enough information so someone can help me, This is my first question so don't be to hard on me and tell me if I am missing something.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)