Tagged Questions
-3
votes
0answers
59 views
while doesn't returns (python) [closed]
I have a little problem with a while that doesn't returns...
The code is like this:
to_Return=True
Correct_Pass=False
while ( to_Return ):
Correct_Pass=False
Count_Tries=0
...
0
votes
0answers
18 views
Set based query to insert multiple records in a new table for each record in the parent table. MySQL
Imagine I have to insert a number of records in a new table for each record in an old table.
As a (hopefully not over-) simplified example I have a table containing linestrings of variable lengths ...
-2
votes
3answers
86 views
while true loop freezes up broswers javascript
so im trying to make the images change and make them into a loop and i came up with this script, and the problem i am having is that, when it change to the second picture the javascript would freeze ...
0
votes
1answer
36 views
PHP error in code, help debugging
This is a Wordpress project (using Advanced Custom Fields) but the error I am getting is due to plain PHP code that I do not have a good enough grasp of. The code below returns a server error and is ...
0
votes
2answers
37 views
Delayed 'for loop' in javascript
I have a delayed loop working that displays the numbers 0-3 with a 1 second delay, but I want it to then start this process all over again.
I tried putting the whole code into a while loop with ...
0
votes
3answers
63 views
A while loop in a while loop in ruby
I'm relativly new to Ruby, or Programming at all, so please excuse me, if i'm making a "noob2 mistake with the logic here.
I am trying to get an output of rgba pixel values in binary for every pixel ...
0
votes
4answers
44 views
Weird behavior of php loops [closed]
<?php
$i = 0;
while($i<=10 ){
echo '<label for=""></label><select name="comp'. $i++ .'></select><br>';
}
?>
I'm using this code for adding 10 ...
0
votes
3answers
43 views
While loop makes applet white screen and unresponsive
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 ...
0
votes
0answers
67 views
Yes/no with a While loop in Python? [closed]
I'm having an issue with my While loop in Python. I'm wanting it to be like the user can enter in either a "y" or a "n". If it's an "y", I want the While loop to break and continue on, if it's an "n" ...
0
votes
2answers
26 views
Javascript comparisons not working with prompts, while loop, and !==
What I'm trying to do is prompt the user repeatedly until one of the accepted answers is received. Pretty easy stuff. The while loop, however, is making this really weird and annoying. Here's what I ...
0
votes
2answers
61 views
PHP - Inserting multiple rows in a while loop
Im trying to insert multiple rows in a while loop with a form using implode but cannot seem to make it work. Pls help. I want to insert multiple values named "weight". Like values 30,20,15,10,5 and ...
0
votes
1answer
40 views
While read line, awk $line
I have a file that contains a list of numbers. I have a second file with various entries and several fields each.
What I want to do is to get all the lines whose 12th field is equal to the 1st ...
-1
votes
1answer
38 views
PHP - fetching and inserting inside the loop
I have a problem. Im using a while loop. I placed a inside the query $rows['price']. How do I submit the entire inserted values inside the loop to a table?. It has 5 results.
page1.php
...
0
votes
2answers
42 views
How to run a loop in bash to match a string and execute another command ONCE
Here's what I'm trying to accomplish. I want to run a loop until a string is matched, execute a do command ONCE and move on to the rest of the script? For example
string=`tail ...
-2
votes
5answers
55 views
My while loop exits prematurely
thanks for reading this.
I am writing a code to read a big data file. And I try to use a while loop to read it one piece at a time.
But when I write
while(TimeStep++)
it will exit at the first ...
1
vote
2answers
63 views
How to break from a loop after the condition is met
Hi I have been trying for the past hour to break from this loop and continue since already met my condition once. My application pretty much reads a serie of lines and analyzes it and then prints the ...
1
vote
4answers
60 views
while loop doesn't terminate properly
I suspect this might have something to do with rounding errors since I'm using doubles to control the loop termination, but I'd like to really know what's going on
#include<iostream>
using ...
0
votes
2answers
35 views
PHP While loop skipping code
I have a while loop in PHP with various calculations as well as a number of IF/ELSE statements. It is hard coded to loop 100 times or until it is broken if a certain condition is met. Each time the ...
0
votes
1answer
36 views
Looping through function until condition is met
I'm trying to build a php function that checks if a certain url exists in the database:
$sql = "SELECT * FROM taskProposals WHERE url='$string'";
$query = mysql_query($sql);
$quantity = 0;
...
0
votes
4answers
53 views
Small program having some looping issues
Just having a small issue with a small program that i'm doing for my entry level programming course.
This loop is infinitely repeating and I can't seem to figure out why. I'm suspecting that the ...
0
votes
0answers
27 views
ajax php add to sql stuck in infinite loop i think
Firstly, this might be a related issue, but I think he's able to cut it off somehow.
SQL query stuck in infinite loop
My problem is that I was messing with an Ajax PHP script that access mySQL and ...
1
vote
1answer
37 views
How to increment an array in a loop
I am trying to post the contents of an array to a MySQL database using PHP.
$i = 0;
while($i < 8 ) {
mysql_query("INSERT INTO posted (posty)
VALUES ('$nummARAY[1]')");
$i = $i +1;
}
But I ...
1
vote
2answers
47 views
ArrayList keeps resetting after loop. what am I doing wrong?
Everytime I loop through the arrayList, it resets itself. Eventually the goal is to make a program that finds the mean of numbers in an arrayList
public class loops {
public static void ...
-2
votes
3answers
73 views
While loop won't stop looping Java
I have created simple table called Reservations and this table have following columns: ID, DUE_DATE, PRODUCTS_PAID, RESERVATION_NAME, SALE, TOTAL_SELL_PRICE and CUSTOMER_ID.
Now what I want to do is ...
0
votes
1answer
30 views
Curl within while loop only sending variables once but runs the loop multiple times
The code below is only sending one variable to my script but it is running trough the loop as normal. I would appreciate some help with this. Thank You.
<?php
$result = mysql_query("SELECT ...
0
votes
1answer
13 views
Unix for loop, prompt for value. Read value into ArrayVar[i]
I am trying to do a nested if statement inside of a while loop. I get a
unexpected "end of file".
while :
do
if [ "$CHOICE" != "x" -o "$CHOICE != "X" ]
then
echo "Enter two whole numbers ...
0
votes
2answers
76 views
C# Console.Write using While loop to insert more records?
I want to insert a while loop in the following code in order to insert more than one record.
The code output asks for Name and ID and then print them out in a text file.
Here is my code:
...
0
votes
3answers
55 views
PHP: Why is this an endless loop? [closed]
$x = 0;
$y = 0;
while ($x < 6);
{
while ($y < 6)
{
echo "INSERT INTO map_location(xLoc,yLoc) VALUES ($x,$y)";
$y++;
}
$x++;
}
I am trying to generate SQL statements ...
0
votes
1answer
44 views
Using formula as a condition in do while loop
I have a column with Time values:
05:13:32
05:13:32
05:13:32
05:13:32
05:13:33
05:13:33
05:13:34
05:13:34
05:13:35
05:13:35
05:13:36
05:13:36
05:13:36
05:13:37
05:13:37
05:13:38
05:13:38
05:13:39
...
2
votes
5answers
47 views
jQuery Endless Loop to update status
I have a function and will call it everytime a checkbox div is selected from a drop down list. Below is my function:
function arming(){
$('#armText').change(function(){
...
1
vote
1answer
95 views
Why is my “while” condition not being met?
I have been running this and typing "12+" as the expression. When it gets to the while loop it gets stuck as if the condition is never met. I dont see why this is because right before the while loop ...
0
votes
3answers
53 views
Print Message Once Every Million Iterations
I need to write a loop that prints out a message once every million iterations. I want to let it run for 10 seconds (clock time) to see how many statements get printed.
I think I've just tied myself ...
0
votes
2answers
52 views
Infinite While loop in Matlab
I'm trying to write a script file in Matlab that will plot the trajectory of a ball thrown at a specific angle (a), velocity (v) and from an initial height (y0). I have the equation and want Matlab to ...
1
vote
5answers
93 views
Switch statement within while loop in C
Thank you guys for your help. Your guidance helped me better understand what I was doing wrong.
1
vote
0answers
41 views
reduce CPU usage in while loop
How do you limit the CPU of a while loop? (cpu usage 100%)
In this case, the code which is inside the while loop:
Sub start()
listenerThread = New Thread(AddressOf Listen)
...
0
votes
2answers
52 views
How do I use cin in a while loop?
I'm trying to get the user to input their name(s) using a while loop with an array and cin, but after the last person's name is input, the program crashes instead of moving on. Is there a way to fix ...
0
votes
1answer
50 views
PHP Mysql COUNT results in a double loop
I would like to know how can I count the results in case I have two loop ! :
$select = "SELECT X FROM Y"
$result = mysql_query($select,$link);
$total = mysql_num_rows($result);
while($row = ...
-1
votes
1answer
25 views
Loop Images in Pygame? [closed]
In Pygame, I want to loop some images, so it creates an animation. If I simply blit my images only the last one shows up. If I place a while loop before blitting the images, Pygame crashes. I have ...
0
votes
0answers
23 views
save loop cell data to new row in one cell array
ok. I have a tiny question. I have a loop that returns six variables with data. two of those variables consists look like this or similar: X_Dates = [321,12] X_Times = [21,33,45,667,887].
those ...
-1
votes
6answers
72 views
Run a MySQL query inside a MySQL WHILE loop [closed]
I'm still new to php/sql so I was wondering if anyone could explain why this code won't work.
Everything runs fine except the second query inside the WHILE loop. Any help would be appreciated, ...
-2
votes
2answers
32 views
While loop user input in range (Python)
I have some code that I want to ask the user for a number between 1-100 and if they put a number between these it will print (Size: (input)) and break the loop, if however, they put in a number ...
2
votes
1answer
85 views
How can I continuously check the hour within a while loop?
This is my first post and first project in Python. I'm trying to control a hardware sensor through a number of conditions:
If the sensor senses movement, send e-mail and sleep
elif the time range is ...
0
votes
3answers
54 views
While Loop Not Iterating Correctly
I'm working on a computer networks project to simulate the TCp/IP model and I'm having a really weird issue. It's pretty simple, but I just can't figure out what's wrong with my code. Inside my ...
-5
votes
1answer
24 views
How would i loop this Scanner in java?
package javaapplication97;
import java.util.Scanner;
public class JavaApplication97 {
public static void main(String[] args) {
System.out.println("Enter a number: ");
...
-2
votes
4answers
71 views
Would this be a valid way of running a loop in c++?
If I want to have a while loop: while a variable does NOT equal several different values, is this valid?:
while (uInput != ('a' || 'b' || 'c')){
//do something to make it equal one of those
}
...
1
vote
4answers
87 views
Loop not executing more than once
I'm supposed to make a program that continuously accepts desk order data and displays all the relevant information for oak desks that are over 36 inches long and have at least one drawer.
import ...
0
votes
3answers
163 views
do while loop using an if statement to print odd numbers
At the moment I am learning loops. I am trying to create a console application which uses a do while loop to print all odd integers between 20 and 0.
Why when I uncomment if statement below my code ...
0
votes
2answers
79 views
Global Array doesn't update while inside while loop?
I have an array of structs, inside the while loop I add things to that array, however when I print out the array I get the wrong output?
(The last element added is printed out n times, n being the ...
0
votes
1answer
65 views
Python: while loop in noughts and crosses
I have coded a game of noughts and crosses, and am using a while loop to run the game. However, I must be doing something wrong as I cannot get it to print 'You win' or 'You lose' when a ...
0
votes
3answers
90 views
Second input char* makes infinite loop
Below is my C code. The very first input works beautifully, but the second causes an infinite loop. I've flushed the buffer, and I do not have any clue how to solve this.
#include <stdio.h>
...