you’re creating the $data
and $where
values as strings, not arrays.
this:
$data = "array( 'somecol' => '".$newstr."' )";
$where = "array( 'id' => ".$defid." )";
should be:
$data = array( 'somecol' => $newstr );
$where = array( 'id' => $defid );