如何从同一个表中使用两个不同的ORDER by列进行两个$ db->查询,彼此独立于一个php页面?

I want to make two blocktables in one page from the same DB table. The first blocktable I want to ORDER it by "posted_date" column, and the second I want to ORDER it by "numviews" column. I want the both blocktables not influence each other, altough they're on the same page. Is it possible?

I have made like this,

first block

$popresult = $db->query('
    SELECT 
        t.id, 
        t.poster, f.id AS forum_id, 
        f.forum_name, 
        t.subject, 
        t.mainimg, 
        posted_date, 
        t.num_views 
    FROM '.$db->prefix.'forums 
    ORDER BY 'posted_date' DESC 
    LIMIT '.$numtopik.'', true) 
or error('Tidak dapat mengambil topik populer', __FILE__, __LINE__, $db->error()); 

second block

$popresult = $db->query('
    SELECT 
        t.id, 
        t.poster, 
        f.id AS forum_id, 
        f.forum_name, 
        t.subject, 
        t.mainimg, 
        posted_date, 
        t.num_views 
    FROM '.$db->prefix.'forums 
    ORDER BY t.num_views DESC 
    LIMIT '.$numtopik.'', true) 
or error('Tidak dapat mengambil topik populer', __FILE__, __LINE__, $db->error());

but it still got error to fetch.

Can anybody help me please?

In your first query you don‘t order by the date, but use the value of $date in the LIMIT part of your query.

So your last part in your first query, should be more like:

[...] ORDER BY t.`yourDateColumnHere` DESC LIMIT '.$yourLimitVariableHere [...]

Hope that helps! If not, feel free to add a comment!