Ok I did the JOIN, now I need to means to display it so it shows:
Code:
Super Moderators, Administrators
Instead of:
Right now it shows the first result instead of giving both names as there are 2 usergroupid's.
--------------- Added [DATE]1261465186[/DATE] at [TIME]1261465186[/TIME] ---------------
EDIT: I have tried this so far:
PHP Code:
$unames = $filerow['usergroupid'];
$unames = explode(',', $unames);
foreach ($unames AS $utitle)
{
$u = $utitle;
}
Keep in mind this is pulling info from a SELECT with a LEFT JOIN. Here is the entire thing:
PHP Code:
$filesql = $db->query_read("SELECT dls.*, ugroups.usergroupid AS uid, ugroups.title AS uname FROM `" . TABLE_PREFIX . "download` AS dls
LEFT JOIN `" . TABLE_PREFIX . "usergroup` AS ugroups ON (dls.usergroupid = ugroups.usergroupid)
WHERE moderated = '1'");
while ($filerow = $db->fetch_array($filesql))
{
$file_id = $filerow['file_id'];
$version = $filerow['version'];
$name = $filerow['name'];
$title = $filerow['title'];
$description = $filerow['description'];
$usergroupid = $filerow['usergroupid'];
$type = $filerow['type'];
$size = $filerow['size'];
$username = $filerow['username'];
$userid = $filerow['userid'];
$catid = $filerow['catid'];
$bytes = vbmksize($size);
$unames = $filerow['usergroupid'];
$unames = explode(',', $unames);
foreach ($unames AS $utitle)
{
$u = $utitle;
}
echo '<tr><td class="alt2" align="center"><a href="user.php?do=edit&u=' . $userid . '">' . $username . '</a></td><td class="alt1">' . $title . '<br /><a href="download.php?id=' . $file_id . '">' . $name . '</a></td><td class="alt2">' . $description . '</td><td class="alt1">' . $u . '</td><td class="alt2">' . $type . '</td><td class="alt1">' . $bytes . '</td><td class="alt2">' . $catid . '</td><td class="alt1"><a href="download.php?do=okfile&fid='.$file_id.'">Approve ' . $username . '\'s File</a></td></tr>';
}