Tags:
php
Hey alle, jeg håber virkelig at der sidder en derude der kan løse mit problem, da jeg efterhånden er ved at rive mig langhåret over mit problem.
Jeg har lagt nogle data ind i nogle felter i min "groups_own" tabel i min MySQL, men kan simpelthen ikke få dem vist data fra databasefeltet Banner, på min side.
Mine kildekoder ser således ud.
Groups.php
<?php
require('include/config.php');
require('include/function.php');
require('classes/pagination.class.php');
require('language/' .$_SESSION['language']. '/groups.lang.php');
$category = 'Feautured';
$page = ( isset($_GET['page']) && is_numeric($_GET['page']) ) ? $_GET['page'] : NULL;
$chid = ( isset($_REQUEST['chid']) && is_numeric($_REQUEST['chid']) ) ? $_REQUEST['chid'] : NULL;
$b = ( isset($_REQUEST['b']) && strlen($_REQUEST['b']) == 2 ) ? $_REQUEST['b'] : 'ra';
$distinct = NULL;
if ( $chid ) {
$sql_select = "SELECT count(GID) AS total_groups FROM group_own WHERE channel LIKE '%" .mysql_real_escape_string($chid). "%'";
$sql = "SELECT * FROM group_own";
$rs = $conn->Execute($sql);
} else {
switch ( $b ) {
case 'ra':
$category = translate('groups.recently_added');
$sql_count = "SELECT count(GID) AS total_groups FROM group_own ORDER BY gcrtime DESC";
$sql = "SELECT * FROM group_own ORDER BY gcrtime DESC";
break;
case 'mm':
$category = translate('groups.most_members');
$sql_count = "SELECT DISTINCT count(GID) AS total_groups FROM group_mem GROUP BY GID";
$sql = "SELECT DISTINCT *, count(MID) AS total FROM group_mem AS m, group_own AS o WHERE m.GID = o.GID GROUP BY m.GID ORDER BY total DESC";
break;
case 'mv':
$category = translate('groups.most_videos');
$sql_count = "SELECT DISTINCT count(GID) AS total_groups FROM group_vdo GROUP BY GID";
$sql = "SELECT DISTINCT *, count(VID) AS total FROM group_vdo AS v, group_own AS o WHERE v.GID = o.GID GROUP BY v.GID ORDER BY total DESC";
break;
case 'mt':
$category = translate('groups.most_topics');
$sql_count = "SELECT count(DISTINCT(GID)) AS total_groups FROM group_tps";
$sql = "SELECT DISTINCT *, count(o.GID) AS total FROM group_tps AS t, group_own AS o WHERE t.GID = o.GID GROUP BY t.GID ORDER BY total DESC";
break;
default:
$category = translate('groups.featured');
$sql_count = "SELECT count(GID) AS total_groups FROM group_own WHERE featured = 'yes' ORDER BY gname";
$sql = "SELECT * FROM group_own WHERE featured = 'yes' ORDER BY gname";
break;
}
}
$ars = $conn->execute($sql_count);
$total = $ars->fields['total_groups'];
$pagination = new Pagination(ceil($config['items_per_page']/2));
$limit = $pagination->getLimit($total);
$sql = $sql. " LIMIT " .$limit;
$rs = $conn->execute($sql);
$groups = $rs->getrows();
$pagination_url = $config['BASE_URL']. '/usergroups/' .$b. '/{#PAGE#}';
$page_link = $pagination->getPagination($pagination_url);
$start_num = $pagination->getStartItem();
$end_num = $pagination->getEndItem();
STemplate::assign('err', $err);
STemplate::assign('msg', $msg);
STemplate::assign('catgy', $category);
STemplate::assign('page', $page);
STemplate::assign('start_num', $start_num);
STemplate::assign('end_num', $end_num);
STemplate::assign('page_link', $page_link);
STemplate::assign('total', $total);
STemplate::assign('answers', $groups);
STemplate::assign('banner', $gbanner);
STemplate::assign('head_bottom', 'grouplinks.tpl');
STemplate::display('head1.tpl');
STemplate::display('err_msg.tpl');
STemplate::display('search.tpl');
STemplate::display('groups.tpl');
STemplate::display('footer.tpl');
STemplate::gzip_encode();
?>
Groups.tpl (kun lige udsnittet med loop)
{section name=i loop=$answers}
{insert name=group_img assign=groupimg gid=$answers.GID tbl=group_vdo}
{insert name=group_info_count assign=gvdocount tbl=group_vdo gid=$answers.GID query="and approved='yes'"}
{insert name=gid_to_gurl assign=gurl gid=$answers.GID}
{assign var=looprecord value=$smarty.section.i.index}
{if $looprecord%2 eq 0}
{assign var=colorLoop value=""}
{else}
{assign var=colorLoop value=" blue "}
{/if}
<div class="group {$colorLoop}">
<div class="groupthumb">
<a href="{seourl rewrite="group/`$gurl`" url="groups_home.php?urlkey=`$gurl`"}">
{if $groupimg eq ""}
<img class="moduleEntryThumb" height="90" src="{$imgurl}/no_videos_groups.gif" width="120" />
{else}
<img class="moduleEntryThumb" height="90" src="{$baseurl}/thumb/1_{$groupimg}.jpg" width="120" />
{/if}
</a>
<div class="button"></div>
</div>
<div class="groupdesc">
<p>
<strong>
<a href="{seourl rewrite="group/`$gurl`" url="groups_home.php?urlkey=`$gurl`"}">
{$answers.gname}
</a>
</strong>
<br/>
{$answers.gdescn}<br/>
{translate item='global.tags'}: {$answers.keyword}<br/>
{translate item='global.status'}: {$answers.type}
{insert name=time_to_date assign=todate tm=$answers.gcrtime}<br />
{translate item='global.banner'}: {$answers.banner}<br/>
{translate item='global.created'}: {$todate}<br />
<p>
<span class="video"><a href="{seourl rewrite="group/`$gurl`/videos/`$answers.GID`" url="gvideos.php?urlkey=`$gurl`&gid=`$answers.GID`"}">{$gvdocount}</a></span><br />
</p>
</p>
</div>
</div>
<div class="clear"></div>
{/section}
Håber virkelig i kan hjælpe mig, på forhånd tak.
1 svar postet i denne tråd vises herunder
0 indlæg har modtaget i alt 0 karma
0