$result is actually going to be a variable of type 'resource'. if you want to retrieve the resultset from the sql query, you need to use functions such as [man]mysql_fetch_array[/man] or [man]mysql_fetch_row[/man].
setting
$data = mysql_fetch_array($result);
will assume only 1 row should be returned in this case of a username and password being used, that is probably true. now data contains an array of data where each fieldname in the database is an array index.
$data['user'], $data['password'], and $data['directory'] will be valid examples judging by your code. $data['directory'] will hold the directory, which appears to be what you are trying to display by echoing $result.