|
Author |
Message |
Iyonix
WebHelper
Joined: 12 Nov 2002
Posts: 82
Location: Yarm, England
|
Posted:
Sun Dec 21, 2003 9:55 am (21 years ago) |
|
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 |
|
|
|
adam
Forum Moderator & Developer
Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Sun Dec 21, 2003 11:41 am (21 years 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 |
________________________________ It's turtles all the way down... |
|
|
|
jayant
Team Member
Joined: 07 Jan 2002
Posts: 262
Location: New Delhi, India
|
Posted:
Tue Dec 23, 2003 8:36 am (21 years ago) |
|
|
|
|
|
|
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.
|
Page generation time: 0.14435 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |