Hi, I have a mysql table like this
-----------------------------------------------
UserID Email Joined Country
-----------------------------------------------
Justin
[email protected] 110815 USA
-----------------------------------------------
What I want to achieve is to keep the 5 recent pages viewed by each user.
For example,
---------------------------------------------------------------------------------------------------
UserID Email Joined Country Act5 Act4 Act3 Act2 Act1
---------------------------------------------------------------------------------------------------
Justin
[email protected] 110815 USA 8.php 6.php 5.php 3.php 1.php
---------------------------------------------------------------------------------------------------
So only the 5 recent pages are inserted and when the user views the 6th page,
the oldest record gets dropped and the 4 last pages moves to the right by 1 column.
---------------------------------------------------------------------------------------------------
UserID Email Joined Country Act5 Act4 Act3 Act2 Act1
---------------------------------------------------------------------------------------------------
Justin
[email protected] 110815 USA 8.php 6.php 5.php 3.php
---------------------------------------------------------------------------------------------------
And then the last viewed page gets inserted.
---------------------------------------------------------------------------------------------------
UserID Email Joined Country Act5 Act4 Act3 Act2 Act1
---------------------------------------------------------------------------------------------------
Justin
[email protected] 110815 USA 11.php 8.php 6.php 5.php 3.php
---------------------------------------------------------------------------------------------------
I know how to use php to take the page name value to mysql query but I don't know
how to use the SQL commands to do this.
Does anyone know how to do this? or is there a better way to do it?
Some help would be great, thank you.