Trouble reading out variable from MySQL sp

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);


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?

Any ideas?

this works for me :)

	$command = Yii::app()->db->createCommand("call proc_new_form($client_id, $query_id, @out)");


	$form_id = Yii::app()->db->createCommand("select @out as result;")->queryScalar();


Thanks, I’ll try your suggestion and see what happens.

Yes, your suggestion is the one that finally works. I really appreciate it! :)