leisure Posted May 26, 2005 Report Share Posted May 26, 2005 Kaa veikt updeiti: piem datubaazee ir 4 lauki - id, skaitlis1, skaitlis2, rezultats kad admin sisteemaa nospiezh pogu, tad abi shie lauki 2, 3 izpilda matemaatiskaas f-cijas un atrisinaajums ir 4 laukaa... kaa to izdariit? Link to comment Share on other sites More sharing options...
Venom Posted May 26, 2005 Report Share Posted May 26, 2005 UPDATE tabula SET rezultats=skaitlis1+skaitlis2 [WHERE id=N] Link to comment Share on other sites More sharing options...
bubu Posted May 26, 2005 Report Share Posted May 26, 2005 UPDATE table SET rezultats = skaitlis1 * skaitlis2 [WHERE ...] Link to comment Share on other sites More sharing options...
Venom Posted May 26, 2005 Report Share Posted May 26, 2005 bugagā, great minds think alike? Link to comment Share on other sites More sharing options...
bubu Posted May 26, 2005 Report Share Posted May 26, 2005 :)) Link to comment Share on other sites More sharing options...
Grey_Wolf Posted May 26, 2005 Report Share Posted May 26, 2005 UPDATE table SET rezultats = skaitlis1 * skaitlis2 [WHERE ...] 18029[/snapback] piebilde: rezult= (jepkura MYSQL atbalstiita matemaatiskaa vai logjiiskaa funkcija) :) Link to comment Share on other sites More sharing options...
bubu Posted May 26, 2005 Report Share Posted May 26, 2005 Tikpat labi arī nematemātiskās operācijas der - datuma formātēšana / operācijas ar stringiem, utt Link to comment Share on other sites More sharing options...
leisure Posted May 26, 2005 Author Report Share Posted May 26, 2005 jaa viss jau buutu 4ikeniekaa, bet kaa to izdariit, ka skripts seko katram ierakstam! kas man jaaraxta pie WHERE izteiksmes? Link to comment Share on other sites More sharing options...
Delfins Posted May 26, 2005 Report Share Posted May 26, 2005 skripts seko katram ierakstam! eto kak ? Link to comment Share on other sites More sharing options...
leisure Posted May 26, 2005 Author Report Share Posted May 26, 2005 doma taada, ka shamais sareekjina katrai rindai pa ID tas buutu, ka db ir 2 rindas, vispirms izreekjina 1.rindai... updeito 3 lauku, tad naakamo rindu ... updeito utt... domu uzkjeeri? Link to comment Share on other sites More sharing options...
Venom Posted May 26, 2005 Report Share Posted May 26, 2005 nu ta mūsu ar bubu piemēri tā arī dara Link to comment Share on other sites More sharing options...
leisure Posted May 26, 2005 Author Report Share Posted May 26, 2005 (edited) a kaada ta iisti ir WHERE izteiksme? nevar buut, ka tas WHERE ir ieksh []... man ir shitaa: $q = "UPDATE `".$config['prefix']."teams` SET `T_WPOS` = `T_GP` * `T_PO` [WHERE `ID` = N] "; tur kk naw pareizi... :unsure: Edited May 26, 2005 by leisure Link to comment Share on other sites More sharing options...
Venom Posted May 26, 2005 Report Share Posted May 26, 2005 mjā, [starp rogrammistiem pieņemts ka izteiksme kvadrātiekavās nozīmē to, ka tā var gan būt, gan nebūt], piem. ja tev vajag pār/izskaitļot vīsām rindām, tad: "UPDATE `".$config['prefix']."teams` SET `T_WPOS` = `T_GP` * `T_PO`" ja tikai kādai noteiktai, "UPDATE `".$config['prefix']."teams` SET `T_WPOS` = `T_GP` * `T_PO` WHERE `ID` =".$ID; vai arī tikai tiem, kam iepriekš nav bijis izskaitļots "UPDATE `".$config['prefix']."teams` SET `T_WPOS` = `T_GP` * `T_PO` WHERE `T_WPOS` IS NULL" Link to comment Share on other sites More sharing options...
leisure Posted May 26, 2005 Author Report Share Posted May 26, 2005 paldies par izskaidrojumu! Ideju sapratu, tnx! :) Bet kk sviesc jau nu to4 notika, jo pirmiit aptuveni kk taadu meegjinaaju, bet nesanaaca :PPP vai kk izjauca f-cija round varbuut? Jo man rezultaataa ir iespeejamas arii veertiibas ar komatiem. Kads butu piemeerotaakais lauka tips ja ir iespeejamas gan + gan - veertibas, tas pats INT derees? Link to comment Share on other sites More sharing options...
bubu Posted May 26, 2005 Report Share Posted May 26, 2005 Ja vajag tikai veselus 4-baitīgus skaitļus, tad ar INT pietiks. Ja vajag ar peldošo punktu, tad DOUBLE laikam. Ja naudas summām, tad NUMERIC(M,N). Link to comment Share on other sites More sharing options...
Recommended Posts