php - Escaping Fields Array in CakePHP -
i have:
$subquery = $dbo->buildstatement( array( 'fields' => array( "case when application.program_type_id = 3 , application.program_type_id not null {$keys['program_type_id_program_type_id']} else 0 end program_type_score, case when application.priority_subject_area_id = 1 , application.priority_subject_area_id not null {$keys['priority_subject_area_id_priority_subject_area_id']} else 0 end priority_subject_area_priority_subject_area_score, user.*" ), 'table' => $dbo->fulltablename($this), 'alias' => 'user', 'limit' => null, 'offset' => null, 'joins' => $joins, 'conditions' => array( 'application.state' => 'accepted', 'role.role' => 'mentor' ), 'order' => null, 'group' => null ), $this->user );
i need change case statements this:
case when application.program_type_id = 3 , application.program_type_id not null {$keys['program_type_id_program_type_id']} else 0 end program_type_score
to this:
case when application.program_type_id = $user['user']['value'] , application.program_type_id not null {$keys['program_type_id_program_type_id']} else 0 end program_type_score
how escape $user['user']['value']
? sanitize::escape() work, however, deprecated.
i use single quotes in php way would be:
'case when application.program_type_id = '.$user['user']['value'].' , application.program_type_id not null {$keys['program_type_id_program_type_id']'} else 0 end program_type_score' enter code here
and should done.
one of reasons prefer single quotes. itsybitsy more work, usualy no worry escaping things. atleast als long don't mix html javascript using php variables. gets messy.
hope helps.
Comments
Post a Comment