Learn PDO or MySQLi instead.
Also, one thing to keep in mind while you’re learning: SQL is not part of PHP. It is its own program and its own programming language. All you’re doing in PHP is writing SQL Statements that your database will execute. So, if you have problems, make sure your statements work first, and then try to put them into PHP.