|Users who viewed this page also viewed this page|
| 9:27 pm on Apr 10, 2008 (gmt 0)|
I'm trying to figure out the best way to do a "Users who viewed this page, also viewed this page" based off data from a mysql DB.
I should be able to make this work with just the PageID and UserID which are both columns in the same table.
So far I was thinking I could query all the users who viewed PageID 15. Lets say that returns UserID's 1,2,4,6. I Could then run a separate query and do the totals in PHP. So if user 1 viewed page 3,4,5 and user 2 viewed 3,7,8. Then so far the results should report back that page 3 is the most relevant page so far to return. Obviously VERY inefficient. But I hope this helps to explain what I'm trying to do.
If anyone could get me started on what command or type of join to use for this then I could probably do the rest. Maybe I'm over complicating things...
| 10:08 am on Apr 13, 2008 (gmt 0)|
It is really easy to do this if these pages are actually texts stored in a database. You should create a table with another column which would store users' id. This way you just have to take id of a page, and according to it print out the users' names.
You could solve this problem in another way:
1) create a table which stores pages
2) create a table which has a least three columns (id, user and page), this table should store every user and every page which user has visited
When you want to take all users which have read the text, you should do something like search engine, search table's column pages to match all users who have read this page. While going through the table, you print a user.
Hope this helped, if hasn't, say so and I'll try to do better.
| 8:56 pm on Apr 14, 2008 (gmt 0)|
Somehow it is similar to amazon's feature of "people who bought this also bought this" and the below link is discussion about that feature.