Thanks for answering.
I've removed '$' which was a typo.
I am getting a little closer. I prefer to use the new mysqli statement, since that's what the author refers to ("Building responsive Web Applications - AJAX and PHP"). I also find tutorials using this. I've now changed that line to:
$mysqli = new mysqli('', 'tetest', '', 'ajax' );
And I get:
ERRNO: 2 TEXT mysqli::mysqli() Access denied for user 'tetest'@'monster.dreamhost.com' (using password: YES) LOCATION: /home/.mohave/tetest//index.php, line 9
Which is all very strange since I host everything on DH.
I understand that there's some restrictions when connecting from outside, but the site (index.php) and the db are one the same domain (if possibly not on the same server?).
They are like this:
Nevermind! Got it working now. Had used the wrong user. And now that I am explicitly entering info in mysqli it works. I'll leave this for others reference.
Thanks for the help.