How to show more than 1 users with this code...


Posted on 16th Feb 2014 07:03 pm by admin

Hello,
i have a table that shows users only if I, as Administrator, want to be shown. But its showing just 1 user and i want to show at least 4. If i copy the code, or use loop, its showing the same user 4 times... How to make it show 4 different users? I tried with "LIMIT 1" changed to LIMIT 4, but nothing happens.
Here are the codes:
PHP code
Code: <?php
////////GET LANG IDS
$aValues = array();
$sSql = " SELECT
`languagevar_id`,
REPLACE(`defVarName`, 'home.', '') AS `key`
FROM `advFetMem_settings` WHERE `defVarName` LIKE '%home.%' ";
$rResult = mysql_query($sSql);
while( ($aRow=mysql_fetch_assoc($rResult)) )
$aValues[ $aRow['key'] ] = $aRow['languagevar_id'];
$smarty->assign('aCusLang_advFetMem', $aValues);

//GET SETTING
$sql ="SELECT `setting_username` FROM `se_settings` LIMIT 1";
$result = mysql_query($sql);
$aRow = mysql_fetch_assoc($result);
$bUserNames = $aRow['setting_username'] == 1 ? TRUE : FALSE;


$iTime = time();
$sql = "SELECT
`u`.`user_id` AS `userId`
FROM `advFetMem_info` AS `i`
INNER JOIN `se_users` AS `u`
ON `u`.`user_id` = `i`.`userid`
WHERE
'".$iTime."' BETWEEN `i`.`start` AND `i`.`end`
ORDER BY RAND()
LIMIT 1";
$result = mysql_query($sql);
$smarty->assign('aAdvFetMem', FALSE);
if( $aRow = mysql_fetch_assoc($result))
{
$tempUser = new se_user(Array($aRow['userId']));
$tempUser->user_displayname();
$aRow['username'] = $tempUser->user_info['user_displayname'];
$aRow['photo'] = $tempUser->user_photo("./images/nophoto.gif", TRUE);
$smarty->assign('aAdvFetMem', $aRow);
}
?>
TPL code
Code: {* include_advFetMem_home.tpl 2009-07-21 12:57:53 rhutton *}
{if $aAdvFetMem}

<div class='header'>{lang_print id=$aCusLang_advFetMem.featured_member}</div>
<div class='portal_content'>
<table cellpadding='0' cellspacing='0' align='center'>
<tr>
<td class='portal_member' valign="bottom" style="width:50%;">
<a href='./profile.php?user_id={$aAdvFetMem.userId}'>{$aAdvFetMem.username|truncate:15:"...":true}</a><br />
<a href='./profile.php?user_id={$aAdvFetMem.userId}'><img src='{$aAdvFetMem.photo}' class='photo' width='60' height='60' border='0' alt='' /></a><br />
</td>
</tr>
</table>
</div>
<div class='portal_spacer'></div>
{/if}
Thank you!

No comments posted yet

Your Answer:

Login to answer
65 Like 14 Dislike
Previous forums Next forums
Other forums

PHP header help!
Hi all I am trying to get this php page to refresh every 5 seconds on my phone which is an aastra 48

turning an array into a string then poping it into a db
Hi im just wondering how you get a requested array into a single string then pop it into the db so f

Appending GET data with form submition
Okay, what I'm trying to do is to use a form to append an already existing GET data string.

I

Showing selected item at top of list
Hi,

I've got a list of names which i am fetching from database like this:
$qry = db_query

links using header()
Hi All

I'm not sure where to ask for help on this but I hope someone can offer some. I'm at

help with calculations on a flat text file
hello,
I have this code below that is attached to a flat file like this:
Email:LastName:FirstN

phph within href not showing php if change ? to &
Code: [Select]<a href="<?php echo $puser; ?>?m=<?php=(($m-1)&l

Date Format
Hi there,

I have a date format like this right now:
Sat, 17 Oct 2009 17:04:00

I ne

Convert .fdf to .pdf
I currently have a web form that uploads the form data to an .fdf file and emails it.

However

Pulling out some result data from MYSQL
Hey Guys,

I've built a PHP page that has a for just imagine something like registration form

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash