leisure Posted May 14, 2005 Report Share Posted May 14, 2005 (edited) elseif( $teamID == "All" ) { $q = "SELECT * FROM `".$config['prefix']."reg` WHERE `T_READ` = 0 "; $sql->db_Query($q); while($row = $sql->db_Fetch() ) { $t = time(); $q = "INSERT INTO `".$config['prefix']."teams` VALUES(NULL, '$row[1]', '$row[2]', '$row[3]', '$row[4]', '$row[5]', '$t', '0') "; $sql->db_Query($q); } $q = "UPDATE `".$config['prefix']."reg` SET `T_READ` = 1"; $sql->db_Query($q); $text .= $site->msg_stuff_normal(LAN_42); } Kuraa vietaa shajaa skriptaa ir kluuda, jeb kaads buutu variants kaa izpildiit nepiecieshamo: Ja caur $_GET dabon, ka teamID = all, tad no tabulas reg nokopee visus ierakstus uz tabulu teams + tabulaa reg lauks T_READ updeitojas uz 1... Edited May 14, 2005 by leisure Link to comment Share on other sites More sharing options...
bubu Posted May 14, 2005 Report Share Posted May 14, 2005 (edited) Kļūdas paziņojumus nemet? error_reporting(E_ALL) mēģināji? Un vai tad šādi var stringā likt iekšā masīva elementus? $q = "INSERT INTO `".$config['prefix']."teams` VALUES(NULL, '$row[1]', '$row[2]', '$row[3]', '$row[4]', '$row[5]', '$t', '0') "; Nevajag šādi? $q = "INSERT INTO `".$config['prefix']."teams` VALUES(NULL, '{$row[1]}', '{$row[2]}', '{$row[3]}', '{$row[4]}', '{$row[5]}', '$t', '0') "; Vēl iesak upaskatīties par šādu SQL sintaksi: INSERT INTO table SELECT ... FROM ... Tb vienā darbībā izselektēto uzreiz ieliek tabulā, būs noteikti daudz ātrāk. http://dev.mysql.com/doc/mysql/en/insert.html Edited May 14, 2005 by bubu Link to comment Share on other sites More sharing options...
leisure Posted May 14, 2005 Author Report Share Posted May 14, 2005 nee, error pazinjojumus nemet aaraaa... a ko mainiis '{$var}' ? buus aatraak? es visu laiku izmantoju taadu metodi kaa redzi, bet itkaa viss bija shotokz :P es palasiishu to doci ko iedevi... tnx :) Link to comment Share on other sites More sharing options...
leisure Posted May 14, 2005 Author Report Share Posted May 14, 2005 ooo jee man izdevaas :) tnx, bet kaa man dariit, zinot to, ka 2.tabulaa (teams( ir par 2 laukiem vairaak) ? bet tajos laukos ir jadabuu arii infa? Link to comment Share on other sites More sharing options...
bubu Posted May 14, 2005 Report Share Posted May 14, 2005 Nu kā par vairāk, tipa reg ir 2 lauki, bet teams ir 4 lauki? Nu a ko tu tajos gribi likt, ja konstantes, tad dari šādi: INSERT INTO teams SELECT lauks1, lauks2, 'konstante1', NULL FROM reg WHERE ... Tak visprastākais selekt teikums tur der. Link to comment Share on other sites More sharing options...
Recommended Posts