1

Topic: Topic title on index

Over at PunRes:

// Afficher le titre du dernier topic
    $queryid = $db->query('SELECT topic_id FROM '.$db->prefix.'posts WHERE id='.$cur_forum['last_post_id']);
    $idm = $db->result($queryid);
    $queryid = $db->query('SELECT subject FROM '.$db->prefix.'topics WHERE id='.$idm);
    $idm = $db->result($queryid);

Can this be made into one query?

Re: Topic title on index

Mmm, in the join, shouldn't p.id be p.topic_id?

Re: Topic title on index

$queryid = $db->query('SELECT subject FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id = p.topic_id WHERE p.id='.$cur_forum['last_post_id']);
$idm = $db->result($queryid);

That's what I get for testing it on a board with 1 topic and 1 post. roll

Re: Topic title on index

You actually tested the query? Wow, you're more careful than me tongue

5

Re: Topic title on index

Thanks Nibbler.