Can I somehow ignore the post with the earliest date? With SQL or PHP?
SELECT subject, date
FROM posts
WHERE id = $id
ORDER BY date DESC
while ($row = mysql_fetch_array($query)) {
Cheers
Can I somehow ignore the post with the earliest date? With SQL or PHP?
SELECT subject, date
FROM posts
WHERE id = $id
ORDER BY date DESC
while ($row = mysql_fetch_array($query)) {
Cheers
You could probably write some convoluted sql to do it, or you could just do it in your php:
$first = true;
while ($row = mysql_fetch_array($query)) {
if ( $first ) {
$first = false;
continue;
}
// Process rows here
}
I've got nothing to test this with, but would this work?
SELECT subject, date
FROM posts
WHERE id = $id
OFFSET 1
ORDER BY date DESC
Or for MySQL five compatibility as pointed out in the comments
SELECT subject, date
FROM posts
WHERE id = $id
LIMIT 1,18446744073709551615;
ORDER BY date DESC
The large number was copied exactly from the MySQL docs.
Assuming date uniquely determines a row for a given id,
SELECT subject, date
FROM posts
WHERE id = $id
AND date NOT IN
( SELECT MIN(date)
FROM posts
WHERE id = $id
)
ORDER BY date DESC