while-loop

SQL stored procedure works but with errors

我们两清 提交于 2019-12-12 04:02:36
问题 I have table with 3 primary keys : CODE_TARIF, UNITE , and MODE_LIV . I write a stored procedure to copy and paste but with different MODE_LIV . ex: if I already have 2 rows in table T_TARIF with MODE_LIV = 2, when I run this stored procedure with input MODE_LIV =3 , I will have 4 rows . ALTER PROCEDURE [dbo].[Copy_Tarif] -- Add the parameters for the stored procedure here @MODE_LIV int AS BEGIN DECLARE @CODE_TARIF varchar(15) DECLARE @ZONE int DECLARE @UNITE int DECLARE @LIBELLE varchar(30)

While loop makes applet white screen and unresponsive

不问归期 提交于 2019-12-12 03:54:15
问题 Here is my loop code (This is the only code relating to my loop): while(true) { try { Thread.sleep(20); System.out.println("1"); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } When I launch the applet, it white screens and I cannot close it unless I press the "Terminate" button in eclipse. 回答1: You're blocking the UI Thread with an infinite while loop. You don't say whether you're using an AWT or Swing applet, either way the result will be the

How to avoid violating the DRY principle when the boolean expression of a while loop is reassigned every loop pass?

喜欢而已 提交于 2019-12-12 03:49:34
问题 Both while MyFunction(1, 2, 3) > 0 do begin Temp := MyFunction(1, 2, 3); ShowMessage(IntToStr(Temp)); end; and Temp := MyFunction(1, 2, 3); while Temp > 0 do begin ShowMessage(IntToStr(Temp)); Temp := MyFunction(1, 2, 3); end; violate the DRY principle because there are two calls to MyFunction when only one is necessary. 回答1: Easy, function dotemp(a,b,c:integer;var value : integer):boolean; begin value:a*b+c; result:=value>0; end; begin while dotemp(a,b,c,temp) do begin Operateontemp(temp);

How to stop a while loop to get input from user using Tkinter?

a 夏天 提交于 2019-12-12 03:46:15
问题 it is incredible how the knowledge of something so basic can be buried in a so hard to find place. I have spent close to a month googling for an answer--watching videos, reading documents, books, etc--of how to stop a while loop to get input from an user using Tkinter. My code below is looping twice and leaving the loop before I am able to provide an input!!! Anyway, theory is appreciated, but a sample code will be of greater help. Thank you very, very much indeed. # Python 3.5.1 from tkinter

Python: Adding values in a while loop

孤者浪人 提交于 2019-12-12 03:45:53
问题 Using a while loop, I'm prompting the user to enter 5 different numbers and trying to create a total of those numbers. How would I be able to create that total? This is my code so far count = 1 while count < 5: count += 1 int(input("Enter a value: ")) 回答1: count = 1 total = 0 while count < 5: count += 1 total += int(input("Enter a value: ")) print (total) 来源: https://stackoverflow.com/questions/40026355/python-adding-values-in-a-while-loop

Get all data from mysql row in a variable

妖精的绣舞 提交于 2019-12-12 03:42:45
问题 I'm stuck on something small, hope you can help me.. I need all phone numbers (thats a column in table 'leerlingen') in one here, with comma's separated, so I can insert that here in another script and it shows all phone numbers, like this: 0612345637,061231823,061231723 Code: $result = mysql_query("SELECT * FROM leerlingen WHERE klas_id='$aan_klas'"); while($row = mysql_fetch_array($result)) { $variabele = $row['leerling_nummer'] . ","; echo "$variabele"; } But, when I echo $variabele

First record from database is not displayed?

纵饮孤独 提交于 2019-12-12 03:36:54
问题 Trying to work on a clients site and I am having a bit of difficulty. When I have no entries in the database, it catches at if(!row) and displays the message. This part works fine. My issue is when I have entries in the db, they do not display. I know the while loop works because I have several pages running a similar loop. In fact, this loop was copied from another page that displays this entry's information on a public page. I know this site is mainly for questions, but I think I just need

Loop that prompts user until valid input [closed]

怎甘沉沦 提交于 2019-12-12 03:34:49
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . Question: How to continuously prompt user when age is invalid (below 0 above 200, or not-a-number)? var userAge = prompt("Please enter your age"); while (isNaN(userAge)){ alert("That's not a number, please retry."); var userAge = prompt("Please re-enter your age."); } if (userAge == 0){ alert("So you're a baby!"

php while loop if to do for first row else to do for second row?

无人久伴 提交于 2019-12-12 03:34:11
问题 I have while loop from mysql , i try to do some thing for first result under if else do other thing for second result etc.... my code this $i = 1; while($row = mysql_fetch_array($get_row)) { $rowid = $row['rowid']; $number = $row['number']; $result = $number - 1; if ($result != '0') { // for only first result != 0 do this require('result.php'); $i++; // for all other results != 0 too do this $edit_row = "UPDATE rows SET status = 'Ok' WHERE rowid = '$rowid'"; mysql_query($edit_row); } elseif (

Editing an imploded string

半腔热情 提交于 2019-12-12 03:32:23
问题 I have an application in which I can assign task like cleaning the bathroom, washing the car and etc. I can assign a single task to let's say 3 to 4 persons using the code below if (isset($_POST["btnassign"])){ $proj = $_REQUEST['projhid']; $analyst = $_POST['analyst']; $commaList = implode('| ', $analyst); $queupass = "UPDATE projects set assignedto='$commaList', assignedby = '$uname' where projectname='$proj'"; $queresupass = odbc_exec($conn,$queupass); $notifassign = "New Project