Location: PHPKode > projects > Particle Blogger > particle-blogger/includes/functions_fetch.php
<?php
function GetUsername($userid, $withlink = 0){
	global $db, $config;
	if ($userid == 0){
		$theuser = "Guest";
	} else {
		// ok check the database
		$sql = "SELECT * FROM " . $config["dbprefix"] . "users WHERE ID = " . $userid;
		$thisuser = $db->execute($sql);
		if ($thisuser->rows < 1){
			$theuser = "unknown";
		} else {
			$theuser = $thisuser->fields["username"];
			
			// check for wanting user link as well
			if ($withlink == 1){
				// build a link into the username
				if ($config["friendlyurls"] == "1"){
					$theuser = "<a href=\"member-" . $userid . ".htm\">" . $theuser . "</a>";
				} else {
					$theuser = "<a href=\"member.php?ID=" . $userid . "\">" . $theuser . "</a>";
				}
			}
		}
	}
	
	// return the string
	return $theuser;
}
?>
Return current item: Particle Blogger