I'm not sure exactly how to explain what the query does, however the problem isn't entirely with how it's set up, because it does work, in another instance, when I use it as an array, however it's not working when I use it with mysql_fetch_assoc(), so here is what my original query is(not the one im having trouble with):
SELECT * FROM (SELECT * FROM comments WHERE postID='$id' AND state='0' ORDER BY id DESC LIMIT 3 ) t ORDER BY id ASC
what this does is selects the last 3 comments on a post, then orders them in another way (so they show up in the correct order, old to new) Now this is the query for echoing out the array of comments directly. But now what I want to do, is to just get the first id out of the 3 comments.
here's what I have tried to do (and by the way, this query DOES work, when i replace my previous query to echo out the results in an array, but i need to get just the id for use, i don't want an array):
$previousIDq = mysql_fetch_assoc(mysql_query(" SELECT * FROM (SELECT * FROM comments WHERE postID='$id' AND state='0' ORDER BY id DESC LIMIT 3 ) t ORDER BY id ASC LIMIT 1")); $previousID = $previousIDq['id']; //this doesn't return the id as I want it to.