Welcome to WebmasterWorld Guest from 22.214.171.124
Forum Moderators: open
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...
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.