Jump to content

PHP Loop Error


unemployment

Recommended Posts

I'm trying to get the data for a single user, but I have a loop error and I don't understand why.  Can someone please clarify where I went wrong?

 

function fetch_user_info_mini_profile_by_uid($uid){
$uid = (int)$uid;

$sql = "SELECT
			'${uid}' AS `uid`,
			`username` AS username,
			`firstname`,
			`lastname`,
			`accounttype`,
			`country`,
			`state`,
			`city`,
		FROM `users`
		WHERE `id` = '${uid}'";

$query = mysql_query($sql);

$profile = array();

while (($row = mysql_fetch_assoc($query)) !== false)
{		
	$profile = array(
		'uid'				=> $row['uid'],
		'firstname'			=> $row['firstname'],
		'lastname'			=> $row['lastname'],
		'username'			=> $row['username'],
		'accounttype'		=> ($row['accounttype'] == '1') ? 'Entreprenuer' : 'Investor',
		'country'         	=> $row['country'],
		'state'				=> $row['state'],
		'city' 				=> $row['city'],
		'display_name'		=> ucwords("${row['firstname']} ${row['lastname']}"),
	);
}

$profile['avatar'] = getUserAvatar($row['username']);

return $profile;
}

Link to comment
https://forums.phpfreaks.com/topic/248237-php-loop-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.