MemHT Portal is a Free PHP CMS and Blog
It permit the creation and the management online of websites with few and easy steps.
It's completelly customizable, expandable and suitable for all needs.
Moderators: Moderators
Forum RSS feedReply
How to get newer posts than ... for example mine last visit
AuthorText
daris
Junior Member
Avatar

Posts: 16
Contributes: 0

Gender: _MALE_
Online: No
Date: 17/04/2008 21:14
How to get newer posts than ... for example mine last visit
#post6261
I want to get all newer post than some date (for example mine last visit). How to do it?

SELECT id FROM memht_forum_posts WHERE date > some_date

I don't know how to compare date field
Edited: 17/04/2008 21:17
Sorry for my english Smile
Delete Edit Quote
 
paulo89
Moderator
Developer

Avatar

Posts: 1286
Contributes: 523

Gender: _MALE_
Online: Yes

Version: 3.8.1
Country: Portugal
Languages: Portuguese, Portuguese and little english ^^
Date: 17/04/2008 22:23
Re: How to get newer posts than ... for example mine last visit
#post6262
Hi

This will not work as you want, because you refresh the page and your last login is updated, but here's the same

First we have to get your last login:
code

        $lastlogin = $dblink->get_row("SELECT lastlogin FROM memht_utenti WHERE user='$user'");
        $lastlogin = $lastlogin['lastlogin'];
 


And now we get id´s
code

        $lastposts = $dblink->get_list("SELECT id FROM memht_forum_posts WHERE date < '$lastlogin'");
        foreach ($lastposts as $row_lastposts) {
        $id = intval($row_lastposts['id']);
        echo "$id<br>";
        }
 


For you see that the comparison working change the signal "<" for ">"
Delete Edit Quote
 
Reply
Tags Cloud
Advertising
News Archive
Language
Help MemHT Portal
Navigator
Users Block
Hi Guest
IP: 38.103.63.59

Username
Password
New files
MemHT Wiki
Friends
MemHT Portal is a free software released under the GNU/GPL License by Miltenovik Manojlo