So I have toy'd with this a bit and I can't seem to get the proper if condition to only create the link if the results are something.
The code:
$addonid = $db->query_read ("
SELECT drc.threadid AS threadid
FROM `" . TABLE_PREFIX . "modsys_settings` AS drc
LEFT JOIN `" . TABLE_PREFIX . "thread` AS thread
ON(drc.mod_addons=" . $threadinfo['threadid'] . ")
WHERE thread.threadid IN (" . $threadinfo['threadid'] . ")
");
$post['addons'] = '<ul>';
while ($addons = $db->fetch_array ($addonid)) {
$ci_counter = $db->query_read ("
SELECT drc.mod_addons AS addon, drc.threadid, thread.threadid AS threadid, thread.title AS threadtitle
FROM `" . TABLE_PREFIX . "modsys_settings` AS drc
LEFT JOIN `" . TABLE_PREFIX . "thread` AS thread ON(drc.mod_addons=" . $threadinfo['threadid'] . ")
WHERE thread.threadid IN (" . $addons['threadid'] . ")
");
$counter = $db->fetch_array ($ci_counter);
$post['addons'] .= 'TEST - <li><a href="showthread.php?t=' . $addons['threadid'] . '">'. $counter['threadtitle'] .'</a></li>';
}
$post['addons'] .= '</ul>';
to me it seems like:
$addonid = $db->query_read ("
SELECT drc.threadid AS threadid
FROM `" . TABLE_PREFIX . "modsys_settings` AS drc
LEFT JOIN `" . TABLE_PREFIX . "thread` AS thread
ON(drc.mod_addons=" . $threadinfo['threadid'] . ")
WHERE thread.threadid IN (" . $threadinfo['threadid'] . ")
");
if ($addons['threadid'] != '') {
$post['addons'] = '<ul>';
while ($addons = $db->fetch_array ($addonid)) {
$ci_counter = $db->query_read ("
SELECT drc.mod_addons AS addon, drc.threadid, thread.threadid AS threadid, thread.title AS threadtitle
FROM `" . TABLE_PREFIX . "modsys_settings` AS drc
LEFT JOIN `" . TABLE_PREFIX . "thread` AS thread ON(drc.mod_addons=" . $threadinfo['threadid'] . ")
WHERE thread.threadid IN (" . $addons['threadid'] . ")
");
$counter = $db->fetch_array ($ci_counter);
$post['addons'] .= 'TEST - <li><a href="showthread.php?t=' . $addons['threadid'] . '">'. $counter['threadtitle'] .'</a></li>';
}
$post['addons'] .= '</ul>';
}
would do the trick but that's a no go. How do I only show the list if it has something to display?
Aucun commentaire:
Enregistrer un commentaire