I have a database with lots of rows in it, and each row has a field with the date in it. Date is stored as an integer of format YYYYMMDDHHMMSS, I want to SELECT using PHP and a mySQL query the maximum value of the date in any of the rows with forum id $fid, and put that value into the variable $lastpostdate

SELECT date FROM posts WHERE fid='".$fid."' HAVING date=MAX('date') LIMIT 0,1

is the query I am trying, but either that doesn't work, or I can't work out the PHP to get it into the variable I mentioned above.

Thanks, and a Merry Christmas to you all.
Iyonix

________________________________Iyonix

adamForum Moderator & Developer

Joined: 26 Jul 2002
Posts: 704
Location: UK

Posted:
Sun Dec 21, 2003 11:41 am (14 years, 5 months ago)

I personally would just use this query and ignore all but the first row:

Code:

SELECT date FROM posts WHERE fid = '".$fid."' ORDER BY date DESC

that may not be the most efficient way of doing it, but it should work

You cannot post new topics in this forum.You cannot reply to topics in this forum.You cannot edit your posts in this forum.You cannot delete your posts in this forum.You cannot vote in polls in this forum.