1) You can create any query you want with the recordset. The code should work the same as in any example you are following.
2) You have too many quotes. I think it should be:
<?php
@session_start();
if (! isset($_SESSION["lang"])) {
$_SESSION["lang"] = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
}
?>