Protect queries against SQL injection
-
I am writing a wp plugin. In the admin part, the user can mark with the help of checkboxes what types of posts he wants to select (I get this data from the database). And there is also data that is entered into the form located on the page. And both of these types of data are used in one SQL request.
The request contains data received from the database (post types) and data from the form.
For protect queries against SQL injection attacks you need to use
$sql = $wpdb->prepare( ‘query’ , value_parameter[, value_parameter … ] );
It is necessary to protect from injection only those data that are received from the form located on the site or those that I received from the database too?
- The topic ‘Protect queries against SQL injection’ is closed to new replies.