I'd like to know in Cakephp 2 how to escape special characters to prevent SQL injection?
//input $this->request->data['Model']['name']; // name = 'John "Doe"'
I want name field in post data be prevented from SQL injection before saving into database, so that in database:
id name --------------- 1 John Doe
Many thanksSOLVED sql injection
Use Sanitize Utility class:
App::uses('Sanitize', 'Utility'); //in controller $clean = Sanitize::escape($dirty);
Created: 19 Sep '16
Last Reply: 25 Sep '16
Start baking your own CakePHP application!