Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在多值条件下选择同一表?_Php_Mysql_Sql_While Loop - Fatal编程技术网

Php 如何在多值条件下选择同一表?

Php 如何在多值条件下选择同一表?,php,mysql,sql,while-loop,Php,Mysql,Sql,While Loop,以下是表活动的详细信息 id| uid | acid | type |topic 1 | 01 | 05 | followu |0 2 | 01 | 06 | followu |0 3 | 06 | 23 | asked |5 4 | 06 | 23 | answered|0 5 | 05 | 96 | comments|0 6 | 01 |

以下是表
活动的详细信息

        id| uid | acid | type    |topic
        1 | 01  | 05   | followu |0
        2 | 01  | 06   | followu |0
        3 | 06  | 23   | asked   |5
        4 | 06  | 23   | answered|0
        5 | 05  | 96   | comments|0
        6 | 01  | 5    | ftopic  |0
        7 | 01  | 23   | fasked  |0
        8 | 01  | 58   | asked   |7
        9 | 37  | 58   | answered|0
这是描述

  • followu=UserID(
    uid
    )01在UserID(
    acid
    )05-->[对于id=1]
  • asked=
    UserID 06
    askeing(Post)something,Post id=23-->[for] id=3]
  • 已回答=
    用户ID 06
    acid=34
    回答(发布)了一些东西,这主要是被问34的ID(显示ID=3)-->[对于ID=4]
  • comments=User ID 05评论(Post)某物,Post ID=06-->[对于ID=5]
  • fasked=
    UserID 01
    在一篇被问到的帖子[被问的类型]之后声明,而被问到的(
    acid
    )=23(被问到的
    askedid(acid)
    在id=3中)-->[对于id=7]
提及:

  • 所以我们可以看到
    Userid[01]
    Userid
    05,06之后
  • 我们还可以从
    userid
    05,06中看到一些活动
  • 这里我们还可以看到
    Userid[01]
    id=7
    和ind
    id=9
    中紧跟着一个
    askedid=58
    另一个
    userid 37
    回答了这个问题
  • 总结:

    所以我想用php为userid01创建一个提要列表,他正在按类型跟踪userid01 followu fasked ftopic

    我可以从下面的userid(acid)中获得所有激活,这与uid=userid(acid)相关,但正如我们看到的
    id=9中的
    userid(uid)37
    回答了一篇文章,其中acid=58,这与
    id=8
    askedid(
    acid
    )=58有关。因此Userid(uid)也将获得这个
    id=9
    feed。与往常一样,主题[type=ftopic]后面的用户ID[01]在这里
    topicid[acid=5]
    所以任何被询问的
    类型行都将与
    acid
    匹配,后者等于
    topicid[acid=5]
    ,并且这些行也必须在提要列表中

    所以我试着

    $query = "select * from `activitis` where (`type`='fasked' OR `type`='fuser' OR `type`='ftopic') and `uid`='01'");
    ;
    $result = mysql_query($query);
    if($result){
    while($row = mysql_fetch_array($result))
    {  
    
    ////// Here we can get the following `userid` `topicid` and `askedid` Now we can select  `activities`table  like, for  `userid` selecting `uid` AND for `topicid` and `askedid` selecting `acid` 
    
    ///// But i also wanted the activites of my following userid askedid and topicid related But if I loop again in this Loop i have to loop for separated type `fasked` `fuser` and `ftopic` But i want result like `order by` `id` and mixed type feed. Just like facebook newsfeed its showing mixed type of feed.
    
    }
    }
    

    对不起,读了几遍之后,我真的不明白你的问题。你能澄清一下吗?我在where子句中也注意到了这一点:
    uid
    ='01'uid是字符数据类型还是数字类型?很抱歉,我没有注意到实际上uid是字符数据类型字符或数字类型并不是事实。太短的问题:你可以看到一个表格活动:现在用php制作一个提要列表[比如facebook新闻提要]谢谢你澄清这一点,但不幸的是,我仍然不太理解你的问题:(也许除了我以外的人会到这里来为你回答是的,谢谢..如果我想这样描述的话“我有一个网站,人们互相关注,关注许多话题,在“话题”下提问。人们回答问题,关注问题,喜欢问题,很多人发表评论,喜欢并投票表决答案“但所有内容都保存在一个名为activates的表中。现在,我如何为用户分离提要取决于他们关注的用户、主题和问题……这将非常清楚,但很快我将获得否决票并保留。有人会说,请阅读我们的条款“您尝试了吗?LOLSo…您正在使堆栈溢出?”/