dongyang5716 2014-09-01 14:16
浏览 35
已采纳

不要回显先前值中记录的项目

Hi i have a problem retriving items from my database, I want to retrieve the data just one time and if an item was already retrieved in a previous value to not show that item

PHP

$select_query = "select * from posts";

$run_query = mysql_query($select_query);
while($row=mysql_fetch_array($run_query)){
$post_id = $row['post_id'];
$post_title = $row['post_title'];
$post_date = $row['post_date'];
$post_author = $row['post_author'];
$post_image = $row['post_image'];
$post_keywords = $row['post_keywords'];
$post_content = $row['post_content'];

HTML

<h1 class="centru">The Posts Author are: <?php echo $post_author; ?>
</h1>

EX: On the page this will be displayed:
Jhon
Maria
Jhon
Alex
Jhon
I want to be like this
Jhon
Maria
Alex

  • 写回答

2条回答 默认 最新

  • duanpu1064 2014-09-01 14:19
    关注

    If you just want authors, use

    SELECT DISTINCT post_author FROM posts
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题