dimanche 2 novembre 2014

Integrity constraint violation: 1062 Duplicate entry for Video Embed Field


Vote count:

0




Content Type :- VideoDisplay


Fields:-Name of Video(Type: String), Video(Type: Video Embed Field), Artist(Type : Node Reference Field)


User already created a record of type VideoDisplay.Now as per requirement I can add more Artist to Existing Video.


So I take this approach:-



$node_vids = node_load($videoId);
$node_vids->field_artist[LANGUAGE_NONE] = array(
0 => array('nid' => $form_state['values']['nid']));
$node = node_submit($node_vids);
node_save($node);


But it gives me error saying:


SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'node-143-0-0-und' for key 'PRIMARY'


This error comes up while inserting data in Video(Type:Video Embed Field). But here I want to save Artist(Type : Node Reference Field) field only. I get to know that node_save actually saves all the attributes of Content Type.


After searching net I try to use field_attach_update() but again it is throwing same exception. Please let me know any solution to get out of this problem.



asked 21 secs ago







Integrity constraint violation: 1062 Duplicate entry for Video Embed Field

Aucun commentaire:

Enregistrer un commentaire