I have trouble reading the out variable of a stored procedure in MySQL. The procedure signature in MySQL is:
CREATE PROCEDURE InsertNodeNextToSibling(sibling INT, name VARCHAR(255), descr VARCHAR(2048), active INT, pos INT, OUT newid INT UNSIGNED)
so, newid is the out variable. The PHP code follows:
$query = 'CALL InsertNodeNextToSibling(:parent, :name, :description, :active, '
. ':position, :newid)';
$params = array(':parent'=>intval($_POST['parent_cat_id']),
':name'=>$category->name, ':description'=>$category->description,
':active'=>$category->active, ':position'=>1);
$command = Yii::app()->db->createCommand($query);
$command->bindValue(':parent', intval($_POST['parent_cat_id']), PDO::PARAM_INT);
$command->bindValue(':name', $category->name, PDO::PARAM_STR);
$command->bindValue(':description', $category->description, PDO::PARAM_STR);
$command->bindValue(':active', $category->active, PDO::PARAM_INT);
$command->bindParam(':newid', $newid, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT, 4);
$command->execute();
I run this, but I get a MySQL error:
I searched for several articles in Google, but did not manage to find a solution that works. Is there a way to read the out variable in the end?