Very basic question.. but I'm missing the point.. I have this data on my table:
ID SITEID SECTION
1 1 posts
2 2 posts
3 1 aboutme
4 1 contact
5 2 questions
The output is an array. I can't change it.
I want to make this output on php with a single for loop with that array:
<h1> sections for site 1 </h1>...
by this question what i mean is that if, by example, someone's username is "bob" then the while loop condition will be ($i < 10), and if the username is something else then the while loop condition will be ($i > 10)
if($username == "bob")
{
//make this while loop condition: ($i < 10)
// it means: while($i <10){ so stuff}
}
else
{
...
I've got some code executing in a while(fscanf != EOF) loop.
However, even when fscanf has finished executing, I need to keep running that code until some conditions are met.
I mean I guess I could copy/paste the code to outside the while(fscanf) loop, and only use global variables, but that seems messy. Surely someone has encountered so...
I just started C++ but have some prior knowledge to other languages (vb awhile back unfortunately), but have an odd predicament. I disliked using so many IF statements and wanted to use switch/cases as it seemed cleaner, and I wanted to get in the practice.. But..
Lets say I have the following scenario (theorietical code):
while(1) {
...
I am using a while activity for creating multiple tasks for a workflow. The code is executed fine and the task is created when the loop runs only once. But when the loop runs twice or more, only one task is getting created. Also the WF status shows as Error Occured.
All I want to do here is create multiple tasks (no of tasks depends on ...
This is what I'm doing:
while (@counter < 3 and @newBalance >0)
begin
CASE
when @counter = 1 then ( @monFee1 = @monthlyFee, @newBalance = @newBalance-@fee)
when @counter = 2 then ( @monFee2 = @monthlyFee, @newBalance = @newBalance-@fee)
END
@counter = @counter +1
end
I get this error:
Incorrect syntax near the keyword 'CASE...
There are 3 loops in C: for, while, do-while. What's the difference between them?
For example, it seems nearly all while statement can be replaced by for statement, right? Then, what's the advantage using while?
...
Hello
<?php
$airports = array('LED','DME','SVO','VKO','AER','KRR','IKT','KGP','KHV');
if ($content = getData('LED'))
{
return $content;
}
Need to go on line through the array until the content is not empty!
How?
Sry for bad english
...
Hello all!
Well I have unusual question I think. I am making a web site and the products must be shown as a line I will past a link for better understanding.
http://partyclub.mdkbg.com/products_carbonated_mix.html
Clicking the bottle in the right will change the products to the next. But if you keep clicking will see that when the end...
Which is faster in SQL, While loop, Recursive Stored proc, or Cursor?
I want to optimize the performance in a couple of spots in a stored procedure.
The code I'm optimizing formats some strings for output to a file.
...
I'm trying out several exercises from a Java programming book. I have the code below:
import java.io.*;
import java.util.Scanner;
public class Ex420
{
public static void main( String args[] )
{
String employeeName = "";
double workHours,excessHours, hourlyRates, grossPay;
Scanner input = new Scanner( System.in );
while ( emp...
Hi all,
I'm learning Perl and noticed a rather peculiar quirk -- attempting to match one of multiple regex conditions in a while loop results in that loop going on for infinity:
#!/usr/bin/perl
my $hivar = "this or that";
while ($hivar =~ m/this/ig || $hivar =~ m/that/ig) {
print "$&\n";
}
The output of this program is:
th...
I have written a program in Java which has 5 threads. In the run() I have a while loop which will loop over and over and this loop will loop a lot of times.
While the program is running, it is gradually eating ram bringing the program to a crawl. Is there anyway I can stop it eating all my ram?
Edit:
Actually just thinking about it, i...
I'm trying this simple code, but the damn break doesn't work... what is wrong?
while True:
for proxy in proxylist:
try:
h = urllib.urlopen(website, proxies = {'http': proxy}).readlines()
print 'worked %s' % proxy
break
except:
print 'error %s' % proxy
print 'done'
It'...
Hi guys,
I have a problem, I hope somebody out there can help.
I'm not really good at sql programming so I need help from u guys.
Here's my problem, I have customercode that has possible of 2 or 3 addresses.
sample:
cust1 address1
cust1 address2
cust1 address3
cust2 address1
cust2 address2
I want to generate a report in .net to...
Recently I experienced this weird problem:
while(list($key, $value) = each($array))
was not listing all array values, where replacing it with...
foreach($array as $key => $value)
...worked perfectly.
And, I'm curious now.. what is the difference between those two?
...
Is while True an accepted method for looping over a block of code until an accepted case is reached as below? Is there a more elegant way to do this?
while True:
value = input()
if value == condition:
break
else:
pass
# Continue code here.
Thank you for any input.
...
Hello guys,
we've codeded this PHP-Script:
function price($id)
{
$ergebnis = mysql_query("SELECT * FROM preiszuordnungen where id=$id");
while($row = mysql_fetch_object($ergebnis))
{
//Wenn grundpreis dann färben
if($row->typ=="grundpreis")
{
...
I have this bit of code which loops through an array and echos out the result to the page thus:
while($row = mysqli_fetch_array($result)) {
echo '<tr><td><a target="_blank" href="' . $row['url'] . '">' . $row['name'] . '</a></td>' . '<td>' . $row['provider'] . '</td>' . '<td>' . $row['media'] . "</td></tr><br />\n";
}
...
I have a table which contains a list of categories and and another table which contains a list of products in each category.
e.g.
CatID | Cat_Name
----------------
1 | Books
2 | CDs
and
ProductID | Product_Name | CatID
------------------------------------
1 |The Bible | 1
2 |The Koran | 1
...