Jump to content


This topic is now archived and is closed to further replies.


creating a post made since last visit problem

Recommended Posts


on a news program i made i want to allow my members to see what new articles were made since they last visited the site. pretty much what i want to do is exactly how phpbb and other bbs programs do.

now looking at them i applied the same method but it doesnt seem to work.

first off i added a colume last_visit which would have the last time they visited the site(in time())

then i made it do a search with the following query:

[code]SELECT * FROM metal_posts WHERE Date>='$last_visit'[/code]

now doing it that displayed 0 results everytime no matter what. changed >= to <= just displayed all of the news articles.

so question is, what am i doing wrong?

to let you know all the dates on my program are in time() format so format issue isnt the problem here.


Share this post

Link to post
Share on other sites
make sure you ARE using a timestamp for both variable types. That is a timestamp for the last login and a tiemstamp for the ews article. Assuming that is all in order, make suer you are assiging a value to last vistit

It may be that you instead use a join on the tables liek so....
$qry = "SELECT `metal_posts`.* FROM `metal_posts`, `user` WHERE `metal_posy`.`Date` >= `user`.`lastlogin` AND `user`.`id` = $_SESSION['id']";
$qry = mysql_query($qry);
Now the field names need to be matched up (unless I am teh best guesser in the world!) but that should not be a problem! and the $_SESSION can be what ever you use to identify the user 9again I assume you use sessions witch may not be the case....

Share this post

Link to post
Share on other sites
actually im using cookies ;)

and i got the problem solved, though now i have another problem.

to solved it i forgot i had to check the read table i made.

now i still have one issue and thats getting the correct number result. tried looping it but it doesnt seem to want to do that.

here is how im doing that:

[code] while ($row = mysql_fetch_assoc($search_result)) {

$db->run = "select * from post_read WHERE Topic='$row[tid]' and user='$logged_user'";
$t_num = $db->num_results();

i might be missing something but i cant think of what that is. if someone here knows, please tell me.


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.