mysql_query('CREATE TEMPORARY TABLE tmptable SELECT * FROM zr_zinojumi WHERE RZNM_ID='.$messageId.';');
mysql_query('UPDATE tmptable SET RZNM_RPRJ_ID='.$izv.', RZNM_ID='.$id.' WHERE RZNM_ID='.$messageId.';');
mysql_query('INSERT INTO zr_zinojumi(`RZNM_ID`,`RZNM_IDENTIFIKATORS`,RZNM_KRFK_ZIN_VEIDS,RZNM_KRFK_PRIORITAT,RZNM_KRFK_SNIEG_VEIDS,RZNM_KRFK_SMAGUMS,RZNM_ISS_APRAKSTS,RZNM_APRAKSTS,RZNM_NUMURS,RZNM_SASK_DATUMS,RZNM_PLAN_IZP_DATUMS,RZNM_PRASIBA,RZNM_NOVERTEJUMS_STUNDAS,RZNM_RPRJ_ID,RZNM_RZNM_ID_DUBLICE,RZNM_RZNM_ID_AIZVER,RZNM_RKLN_ID,RZNM_RVNM_ID,RZNM_RVVR_ID,RZNM_RVVR_ID_JAIEVIES,RZNM_RVVR_ID_IEVIESTS,RZNM_RLTT_ID_INS,RZNM_RLTT_ID_UPD,RZNM_DATUMS_INS,RZNM_DATUMS_UPD,RZNM_KSTV_KODS) SELECT
RZNM_ID,
RZNM_IDENTIFIKATORS,
RZNM_KRFK_ZIN_VEIDS,
RZNM_KRFK_PRIORITAT,
RZNM_KRFK_SNIEG_VEIDS,
RZNM_KRFK_SMAGUMS,
RZNM_ISS_APRAKSTS,
RZNM_APRAKSTS,
RZNM_NUMURS,
RZNM_SASK_DATUMS,
RZNM_PLAN_IZP_DATUMS,
RZNM_PRASIBA,
RZNM_NOVERTEJUMS_STUNDAS,
RZNM_RPRJ_ID,
RZNM_RZNM_ID_DUBLICE,
RZNM_RZNM_ID_AIZVER,
RZNM_RKLN_ID,
RZNM_RVNM_ID,
RZNM_RVVR_ID,
RZNM_RVVR_ID_JAIEVIES,
RZNM_RVVR_ID_IEVIESTS,
RZNM_RLTT_ID_INS,
RZNM_RLTT_ID_UPD,
RZNM_DATUMS_INS,
RZNM_DATUMS_UPD,
RZNM_KSTV_KODS
FROM tmptable WHERE RZNM_RPRJ_ID='.$izv.';');