So your friend suggested you to send SQL to the database with JavaScript instead of PHP?
PHP is a server side language, HTML5 JS is on client side. So if it was possible (but it's not) to send data to the database server directly with JS, then imagine how insecure would it be. You would have to log in to the database and what goes after, store credentials on client side.
So in short words you must have a bridge (like PHP) in order to send data to the database from the browser.