Aleksejs Posted August 16, 2007 Report Share Posted August 16, 2007 (edited) Un pēc būtības... vai nav tā, ka pietiek ar vienu SQLu: UPDATE tabula SET lauks = 0 WHERE lauks = 1 Uj, jau sākumā tika pateikts, sorry. :) Edited August 16, 2007 by Aleksejs Link to comment Share on other sites More sharing options...
ray Posted August 20, 2007 Author Report Share Posted August 20, 2007 mana kļūda, bet paldies par atbildēm, doma bija šādam kodam/vaicājumiem: $query = "SELECT id, lauks_2 FROM tabula WHERE lauks = 1"; $result = mysql_query($query); while($row = mysql_fetch_array($result) { $lauks_2 = $row["lauks_2"]+1; $query_2 = "UPDATE tabula SET lauks_2 = "$lauks_2" WHERE id = ".$row["id"].""; mysql_query($query_2); } Link to comment Share on other sites More sharing options...
andrisp Posted August 20, 2007 Report Share Posted August 20, 2007 Un atkal :): UPDATE tabula SET lauks_2 = lauks_2 + 1 WHERE lauks = 1 Link to comment Share on other sites More sharing options...
Recommended Posts