homepage Welcome to WebmasterWorld Guest from 54.234.228.64
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
Users who viewed this page also viewed this page
matrix223




msg:3623981
 9:27 pm on Apr 10, 2008 (gmt 0)

Hi All,

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...

 

tutorial




msg:3625760
 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.

Mohamed




msg:3626747
 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.
[webmasterworld.com...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved