Answer the question
In order to leave comments, you need to log in
How in Yii, using Active Record, before writing to the database a string with quotes inside, escape these quotes?
How in yii, using Active Record, before writing to the database a string with quotes inside, escape these quotes?
Answer the question
In order to leave comments, you need to log in
It's already out of the box. You don't need to do anything extra.
in the model
protected function beforeSave()
{
if (parent::beforeSave() === false)
return false;
$this->you_attribute = addslashes($this->you_attribute);
return true;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question