Creating a secure and efficient DB connection and queries (using one class)
You say that you use prepared statements, but your code doesn't actually reflect that. 

sql just executes any query, without binding or escaping anything. You really need to use prepared statements though. Your current sql function isn't usable in practice and it's pure existence will likely lead to vulnerabilities (other programmers will likely use it as it exists, and it can't be used securely).

Apart from that:


don't mix different APIs. Currently, you use mysqli and mysql.
don't use mysql, it's been deprecated for years and has finally been removed in PHP7.
your formatting is off. Use correct indentation, always use curly brackets, use newlines for statements (eg after an if), and use spaces around =. Any IDE can fix these things for you.
be consistent with your naming. Your functions should all start with a lower-case character.
Also, same things should be named the same. So if you have a field called connection, the method retrieving it should be getConnection, not getLink.
Also try to be more explicit with your variable names and don't shorten names. val should be value (but really, it should be user or username), res should be result, n should be queryCount, and so on.
It's very unclear to me what n is used for. I would remove it, or document it.
sql isn't really useful. It's just a wrapper around mysql_query which automatically echoes errors (meaning that the calling code has no possibility to recover or show a different error message; throw an exception instead), and provides the possibility to execute multiple queries, which doesn't actually seem needed.
You don't want to create a new database connection for each method (for performance reasons), so instead, create it once and then pass the db object to methods that need it.