<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> <pre class="moz-signature" cols="72">Arba gali buti variantas select sum(vietos) from table_name</pre> <pre class="moz-signature" cols="72">arba <code><span class="pln">$amount </span><span class="pun">=</span><span class="pln"> array</span><span class="pun">(</span><span class="lit">3</span><span class="pun">=></span><span class="lit">5</span><span class="pun">,</span><span class="pln"> </span><span class="lit">4</span><span class="pun">=></span><span class="lit">10</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1</span><span class="pun">=></span><span class="lit">1</span><span class="pun">);</span><span class="pln"> </span><span class="com">// </span></code><code class="moz-txt-verticalline"><span class="moz-txt-tag"></span>Nustatytome kiekvienos vertės suma</code><code><span class="com"></span><span class="pln"> $result </span><span class="pun">=</span><span class="pln"> mysql_query</span><span class="pun">(</span><span class="str">"SELECT id FROM table_name"</span><span class="pun">);</span><span class="pln"> $sum </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln"> </span><span class="kwd">while</span><span class="pln"> </span><span class="pun">(</span><span class="pln">$row </span><span class="pun">=</span><span class="pln"> mysql_fetch_assoc</span><span class="pun">(</span><span class="pln">$result</span><span class="pun">))</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> $sum </span><span class="pun">+=</span><span class="pln"> $amount</span><span class="pun">[</span><span class="pln"> $row</span><span class="pun">[</span><span class="str">'id'</span><span class="pun">]</span><span class="pln"> </span><span class="pun">];</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span></code></pre> <pre class="moz-signature" cols="72">ups ----------------------- <a class="moz-txt-link-abbreviated" href="http://www.naujasdizainas.lt">www.naujasdizainas.lt</a></pre> <br> 2010.07.07 18:23, lietus rašė: <blockquote cite="mid:i1264r$35a$1@trimpas.omnitel.net" type="cite">Sveiki, <br> Pameginsiu trumpai aprasyti iskilusia dilema. <br> Reikia padaryti tokia pasieska: <br> Reikia surasti visas masinas. Masinos gali tureti papildoma info tokia kaip sedimu vietu skaiciu (pvz. dviviete, keturviete arba DVIVIETE + 2 IDEDAMOS SEDYNES = 4 sedynes is viso). Iskant masinu kurios gali pavesti 4 zmones reikia kad butu itrauktos ir tos kurios yra dvivietes plius turincios idedamas sedynes. <br> <br> Kaip realizuoti tokia paieska <br> <br> aciu visiems uz info <br> </blockquote> </body> </html>