KeepLearning Posted March 20, 2013 Share Posted March 20, 2013 Version 0.5 Page 167 Quote: "// Works safely: $model = Page::model()->find('id=:id', array(':id'=>$id));" Larry, What exactly does the colon do? What does the array do? I know they make the query safer, but how? Thanks. Link to comment Share on other sites More sharing options...
Larry Posted March 20, 2013 Share Posted March 20, 2013 The colon creates a named placeholder. The array provides a value for the named placeholder(s). This approach makes queries safer as it results in a prepared statement, which prevents SQL injection attacks. Link to comment Share on other sites More sharing options...
Recommended Posts