$query = "IF EXISTS (SELECT id FROM questionary_rights WHERE idquest=$idquest AND iduser=$iduser) THEN UPDATE `questionary_rights`".
" SET iduser='$iduser',idquest='$,idquest,'read'=1".
" WHERE ,idquest=$,idquest AND iduser=$iduser ".
"ELSE ".
"INSERT INTO `questionary_rights`".
" (iduser,idquest,'read')".
" VALUES('$iduser','$,idquest',1)".
" END IF";