TL / DG
Always. 100% of the time, use it. Always; and even if you donβt need to use it. USE STILL.
mysql_* functions are deprecated. ( Pay attention to the big red square? )
Warning This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used. See Also MySQL: API Guide Selection and Related Frequently Asked Questions for More Information. Alternatives to this feature include:
You are better off using PDO or MySQLi . Any of these 2 will be sufficient as compatible libraries when using prepared statements.
Entrusting the user input without prepared instructions / disinfection, this is how to leave your car in a bad area, unlocked and with the keys in the ignition. You basically say, just go in and take my goodies 
You should never , and I mean never, trust user input. If you do not want this:

Regarding the data and its storage, as indicated in the comments, you can never and never should trust any user-related entries. If you are 101% sure that the data used to manage the specified databases / values ββis hardcoded in your application, you should use the prepared instructions.
Now about why you should use prepared statements. It's simple. To prevent SQL injection, but in the most direct way. The way the prepared operators work is simple, it sends a request and data together, but separately (if that makes sense, haha). I mean the following:
Prepared Statements Query: SELECT foo FROM bar WHERE foo = ? Data: [? = 'a value here']
Compared to your predecessor, where you truncated a query with data, sending it as a whole - in turn, this means that it was executed as a single transaction that caused SQL Injection vulnerabilities.
And here is an example of a pseudo PHP PDO to show you the simplicity of prepared statements / bindings.
$dbh = PDO(....); // dsn in there mmm yeahh $stmt = $dbh->prepare("INSERT INTO REGISTRY (name, value) VALUES (:name, :value)"); $stmt->bindParam(':name', $name); $stmt->bindParam(':value', $value); // insert one row $name = 'one'; $value = 1; $stmt->execute();
Adapted from the PHP manual for prepared PDO statements
Read More