|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Carnage Smarty Rookie
Joined: 05 Nov 2004 Posts: 7
|
Posted: Mon Feb 07, 2005 12:32 am Post subject: Aufteilungs-Problem |
|
|
Und zwar habe ich derzeit folgendes Skript:
PHP:
Code: | // Squads werden aus DB ausgelesen
$query = $db->sql_query("SELECT *
FROM ".prefix."_script_squad
WHERE status = 'visible'
");
$i=0;
while($data = $db->sql_fetchrow($query))
{
$squad[$i]["name"] = $data["name"];
$i++;
}
$smarty->assign("squad",$squad);
// Members werden ausgelesen und Squads zugeteilt
$query = $db->sql_query("SELECT ".prefix."_user.user_id, ".prefix."_user.nickname, ".prefix."_user.p_task, ".prefix."_user.activity, ".prefix."_script_squad.name
FROM ".prefix."_user, ".prefix."_script_squad
WHERE ".prefix."_user.squad_id = ".prefix."_script_squad.squad_id
");
$i=0;
while($data = $db->sql_fetchrow($query))
{
$member[$i]["user_id"] = $data["user_id"];
$member[$i]["nickname"] = $data["nickname"];
$member[$i]["task"] = $data["p_task"];
$member[$i]["activity"] = $data["activity"];
$i++;
}
$smarty->assign("member",$member);
|
TPL:
Code: | {section name=id2 loop=$squad}
<table>
<tr><td>{$squad[id2].name}</td></tr>
</table>
<table width="100%">
<tr>
<td align="center"><u>{#nickname#}</u></td>
<td align="center"><u>{#task#}</u></td>
<td align="center"><u>{#activity#}</u></td>
<td></td>
</tr>
{section name=id loop=$member}
<tr>
<td align="center">{$member[id].nickname}</td>
<td align="center">{$member[id].task}</td>
<td align="center">{if $member[id].activity == "active"}<font color="#008000">{#active#}</font>{else}<font color="#ff0000">{#inactive#}</font>{/if}</td>
<td align="center"><a href="{$PHP_SELF}?module=member&action=show&user_id={$member[id].user_id}">{#detail#}</a></td>
</tr>
{sectionelse}
</table><p><table>
{#info_nomember#}
{/section}
</table>
{sectionelse}
{#info_nosquad#}
{/section}
|
Problem ist aber dass die Member nicht zu den jeweiligen Squads zugeteilt werden, sondern dass 2 Testuser in 2 Testsquads drin sind, obwohl 1ner davon in Squad 2 und der andere in Squad 1 seien müsste.
Ist ein bisschen schwer zu erklären.... kann mir da jemand weiterhelfen ? |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|