English 中文(简体)
我如何创造用户历史?
原标题:How do I create a user history?
  • 时间:2010-05-13 01:24:27
  •  标签:
  • php
  • mysql

I want to create a user history function that allows shows users what they done. ex: commented on an ad, posted an ad, voted on an ad, etc.

我如何这样做?

I was thinking about... in my site, when they log in it stores their user_id ($_SESSION[ user_id ])

  1. so I guess whenever an user posts an ad(postad.php), comments(comment.php), I would just store in a database table "userhistory" what they did based on whenever or not their user_id was activate.
  2. When they comment, I store the user_id in the comment dbc table, so I ll also store it in the "userhistory" table.
  3. And then I would just queries all the rows in the dbc for the user to show it

任何步骤/改进 我可以做吗?

问题回答

查阅媒体图象的统计和记录部分。 你们可以执行类似的情况。

同样,你可以做的是我的SQL制成的伐木,因此,我的SQL数据库将每一页打上,该数据库追踪IP、使用、日期和所要求的网页。

然后,在你看来历史的网页上,你可以有这样的文字。 这只是伪装的法典,因此认为它具有价值。

<?php
    $actions = array( comment.php  =>  posted a comment , "postedad.php" => "posted an ad");

    $query = mysql_query("SELECT * FROM logHits JOIN users ON users.id = logHits.userid WHERE loghits.userid = $userid");

    while ($row = mysql_fetch_array($query)) { 
         echo $row[ username ]." ".$actions[$row[ pagename ]."<br />"; 
   }
?>

再说一遍,这只是伪装,你当然能够改进这一概念。 您可能使用印刷版(印刷版)/印刷版(印刷版)等组合,并在行动文本与实际评论的超文本链接中作出“评论”。

要做到这一点,有几个途径。 这或许是最好的。

您也可在用户等表格上插入询问。 每当这些人采取与你所述的行动时,历史就是如此。 这可能是实现这一目标的最佳途径。 你们能够拥有诸如id、使用、行动类型、行动性等领域

行动类型为“comment”或“comment”,行动方式是贴出入境口。 然后,你可以很容易地将行动类型绘制到评论页(绕过行动),以了解实际发表的评论。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签