There are several ways to prevent SQL injection attacks in PHP.
There are several ways to sanitize user input in PHP, depending on the type of data and how you plan to use it.