Trying to save a node containing CCK fields from Flash using the AMFPHP module, gives me:

"mysqli_real_escape_string() expects parameter 2 to be string, array given"

Narrowed the problem down to the use of "drupal_execute" in node_service_save function from the node_service.inc file.

Couldn't work out exactly where things go wrong, but patching things up by replacing the drupal_execute type save with the following works for me for the time being:

$edit = node_submit($edit);
node_save($edit);
content_insert($edit);
$nid = $edit['nid'];
unset($edit);

Comments

robin van emden’s picture

Ah, see I made a small mistake there, should of course be:

$edit = node_submit($edit);
node_save($edit);
content_insert($edit);
$nid = $edit->nid;
unset($edit);

gdd’s picture

Status: Active » Closed (works as designed)

The drupal_execute() method of saving nodes will remain. For more details in this see #275045: node.save with CCK node reference fields

robin van emden’s picture

I understand the choice for drupal_execute. Maybe I shouldn't even have mentioned my temporary workaround. But the point of my post is really the aforementioned error I trace when using the default drupal_execute, and the possibly related problem of my being unable to save any cck field data, even though my temp personal 'hack' gives no error and saves the cck fields.