goleh1995 Posted June 25, 2013 Report Share Posted June 25, 2013 Sveiks - varat man ludzu pastastit kas te ir nepareizi un ka izlabot. $query = 'SET AUTOCOMMIT=0; START TRANSACTION; LOCK TABLES zr_zinojumi WRITE, tmptable WRITE; CREATE TEMPORARY TABLE tmptable SELECT * FROM zr_zinojumi WHERE RZNM_ID='.$messageId.'; UPDATE tmptable SET RZNM_RPRJ_ID='.$izv.' WHERE RZNM_ID='.$messageId.'; INSERT INTO zr_zinojumi SELECT * FROM tmptable WHERE RZNM_ID='.$messageId.'; DROP TEMPORARY TABLE IF EXIST tmptable; UNLOCK TABLES; COMMIT; '; mysql_query($query); Quote Link to comment Share on other sites More sharing options...
daGrevis Posted June 25, 2013 Report Share Posted June 25, 2013 > This extension is deprecated as of PHP 5.5.0, and will be removed in the future. > [..] multiple queries are not supported [..] Quote Link to comment Share on other sites More sharing options...
goleh1995 Posted June 25, 2013 Author Report Share Posted June 25, 2013 bet ka citadi man izdarit to? Quote Link to comment Share on other sites More sharing options...
goleh1995 Posted June 25, 2013 Author Report Share Posted June 25, 2013 Uzdevums:Nokopet visu rindu no tabulas un to rindu ielikt taja pasa tabula bet jau ar izmainito vienu laukumu. Quote Link to comment Share on other sites More sharing options...
goleh1995 Posted June 25, 2013 Author Report Share Posted June 25, 2013 mysql_query('SET AUTOCOMMIT=0;'); mysql_query('START TRANSACTION;'); mysql_query('LOCK TABLES zr_zinojumi WRITE, tmptable WRITE;'); mysql_query('CREATE TEMPORARY TABLE tmptable SELECT * FROM zr_zinojumi WHERE RZNM_ID='.$messageId.';'); mysql_query('UPDATE tmptable SET RZNM_RPRJ_ID='.$izv.' WHERE RZNM_ID='.$messageId.';'); mysql_query('INSERT INTO zr_zinojumi SELECT * FROM tmptable WHERE RZNM_ID='.$messageId.';'); mysql_query('DROP TEMPORARY TABLE IF EXIST tmptable;'); mysql_query('UNLOCK TABLES;'); mysql_query('COMMIT;'); Ari nestrada Quote Link to comment Share on other sites More sharing options...
daGrevis Posted June 25, 2013 Report Share Posted June 25, 2013 Man škiet, tur tos semikolus nevajag. Skaties ko atgriež funkcija un kādi error tiek atgriezti. Quote Link to comment Share on other sites More sharing options...
v3rb0 Posted June 25, 2013 Report Share Posted June 25, 2013 izmantot tmp tabulas parasati skaitās evil un pēdējais ko darīt. m$sql var šādi: insert into TableName(field1, field2, field3) select field1, 'izmainītā lauka vērtība' as field2, field3 from TableName where .. varbūt mysql ar tā darbojas vai kā līdzīgi (nav pie rokas lai pārbaudīt) Quote Link to comment Share on other sites More sharing options...
goleh1995 Posted June 25, 2013 Author Report Share Posted June 25, 2013 CREATE TEMPORARY TABLE tmptable SELECT * FROM zr_zinojumi WHERE RZNM_ID='3594'; UPDATE tmptable SET RZNM_RPRJ_ID='60', RZNM_ID='8000' WHERE RZNM_ID='3594'; select * into zr_zinojumi from tmptable Where RZNM_RPRJ_ID='60' ; te es to ID izmainiju pie UPDATE tagad itka jastarad, bet atkal. #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'zr_zinojumi from tmptable Where RZNM_RPRJ_ID = '60' LIMIT 0, 30 Quote Link to comment Share on other sites More sharing options...
xPtv45z Posted June 25, 2013 Report Share Posted June 25, 2013 Kā tev mysql_query('INSERT INTO zr_zinojumi SELECT * FROM tmptable WHERE RZNM_ID='.$messageId.';'); kļuva par select * into zr_zinojumi from tmptable Where RZNM_RPRJ_ID='60' ; ? Quote Link to comment Share on other sites More sharing options...
goleh1995 Posted June 25, 2013 Author Report Share Posted June 25, 2013 tur vnk dazadi var parvietot, vnk gogleju, okey man tagad ieks phpmyadmion kad parbaudu - strada tnx - bet ieks majaslapas, paradas tads Warning: - Notice: Use of undefined constant RPRJ_ID - assumed 'RPRJ_ID' in D:\WebSites lalalal Quote Link to comment Share on other sites More sharing options...
goleh1995 Posted June 25, 2013 Author Report Share Posted June 25, 2013 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.';'); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.