i have managed to get hold of social engine and trying to edit the profile script to create a friends list like facebook instead of it saying i have so many friends,

This is my first time using smarty so im still learning

this is my profile.php

$page_id = $_GET['user'];
$sql = "SELECT * FROM se_friends WHERE friend_user_id1 = '$page_id' AND friend_status = '1' LIMIT 0,9";
$mysql = mysql_query($sql) or die (mysql_error());
$all_friends = array();
$all_info = array();
while ($rows = mysql_fetch_array($mysql))
	$friend_id = $rows['friend_user_id2'];
	$query = "SELECT * FROM se_users WHERE user_id = '$friend_id'";
	$mysql = mysql_query($query) or die(mysql_error());
	while($get = mysql_fetch_array($mysql)) 
		array_push($all_info, $get);

$smarty->assign("friends_list", $all_info);

then profile.tpl

{section name=i loop=$friends_list}
      	<td><img class='photo' src='./images/nophoto.gif' width="50" height="50" align="absmiddle" border='0'><a style="padding-left:5px" href="profile.php?user={$friends_list[i].user_id}">{$friends_list[i].user_displayname}</a></td>

the first mysql statment works perfectly but the second one is not it only gets one results

5 Years
Discussion Span
Last Post by diafol
while($get = mysql_fetch_array($mysql)) 
		array_push($all_info, $get);

on a quick look, you're passing an array ($get) to be added to the $all_info array. Is that what you want to do?


yes i thought with all the info in a array it would be alot easier to pass around the loads of variables,

and the tutorials i have seen about loops on smarty has all been with arrays

Edited by nats01282: spelling

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.