I’m having some trouble getting my model to update its data in the database.
My current relevant code looks like this, in all its temporary-debugging-code glory:
echo "Here, before database interaction!";
/* if ( $_POST['story_id'] == 'new' ) {
$story->insert();
} else {
$story->update();
} */
$story->save(false);
echo "Here, after DB interaction!";
new dBug( $story->errors() );
new dBug( $story->getErrors() );
echo CHtml::errorSummary($story);
echo "Here, after error summary!";
When I go to execute this, the data is not saved to the database, and the screen output I get is just:
Here, before database interaction!
and that’s the end of the source code; even the view doesn’t finish rendering. This happens whether I’m using save(), insert(), or update().
Other relevant information:
-
I’m using Yii 1.1.14
-
I’m using PHP 5.2.17 (and am on a shared hosting server; I have no access to upgrade to 5.3)
-
There are no PHP errors in the error log
-
YII_DEBUG is set to true
-
I do not have any beforeValidate/beforeSave/related functions in the Story model
-
The database user has permissions to update/insert into the database, and the database connection is good (and data can be loaded into the model with no problems)
-
If I add the validate() function, it returns true, but the save(), insert() and update() methods still terminate the script
-
The same thing happens whether I use save() or save(false)
I’m completely flummoxed. Any ideas what’s going wrong?