KeepLearning 0 Posted March 20, 2013 Report 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. Quote Link to post Share on other sites
Larry 428 Posted March 20, 2013 Report 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. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.