On Aug 31, 2007, at 6:26 PM, Robert Cummings wrote:
On Fri, 2007-08-31 at 15:56 -0700, Dan wrote:
Sanjeev is right. You're thinking about the problem backwards.
You're
trying to build a Switch inside a loop. Remember, if you ever have
to do
some operating multiple times you're using a forlo
On Fri, 2007-08-31 at 15:56 -0700, Dan wrote:
> Sanjeev is right. You're thinking about the problem backwards. You're
> trying to build a Switch inside a loop. Remember, if you ever have to do
> some operating multiple times you're using a forloop, then the thing that
> you want to repeat(swi
age-
From: Hulf [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 16, 2007 3:11 PM
To: php-general@lists.php.net
Subject: [PHP] for loop inside a switch
Hi,
switch ($q) {
for ($i=0; $i <21; $i++) {
case 'faq$i':
echo $faq1;
break;
}
}
I just want to loop out a b
16, 2007 3:11 PM
To: php-general@lists.php.net
Subject: [PHP] for loop inside a switch
Hi,
switch ($q) {
for ($i=0; $i <21; $i++) {
case 'faq$i':
echo $faq1;
break;
}
}
I just want to loop out a big long list of cases.
--
PHP General Mailing List (http://www.php.net/)
To un
Hulf wrote:
Hi,
switch ($q) {
for ($i=0; $i <21; $i++) {
case 'faq$i':
echo $faq1;
break;
}
}
I just want to loop out a big long list of cases.
are the case's that you want to create with the loop going to be the only case
statements in the switch?
--
Jim Lucas
"Some men are
On 8/16/07, Hulf <[EMAIL PROTECTED]> wrote:
> Hi,
>
> switch ($q) {
>
> for ($i=0; $i <21; $i++) {
> case 'faq$i':
> echo $faq1;
> break;
> }
> }
>
>
> I just want to loop out a big long list of cases.
Maybe you want this kind of functionality :
http://www.php.net/manual/en/language.varia
Hulf wrote:
Hi,
switch ($q) {
for ($i=0; $i <21; $i++) {
case 'faq$i':
echo $faq1;
break;
}
}
I just want to loop out a big long list of cases.
That's not a valid construct, but if I understand what you're trying do,
this should work...
$faqs = array();
for ($i = 0; $i < 21; $i+
I don't think it is going to work. IMO
On 8/16/07, Hulf <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> switch ($q) {
>
> for ($i=0; $i <21; $i++) {
> case 'faq$i':
> echo $faq1;
> break;
> }
> }
>
>
> I just want to loop out a big long list of cases.
>
> --
> PHP General Mailing List (http://www.p
Hi,
switch ($q) {
for ($i=0; $i <21; $i++) {
case 'faq$i':
echo $faq1;
break;
}
}
I just want to loop out a big long list of cases.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Albert Padley wrote:
Thanks everyone. Always nice to know there is more than one direction
to go in.
A alternative to variable variables might use these:
http://us3.php.net/manual/en/function.compact.php
http://us3.php.net/manual/en/function.extract.php
'extract' looks like it might be
On Tue, 2006-06-20 at 19:19, Albert Padley wrote:
> Thanks everyone. Always nice to know there is more than one direction
> to go in.
>
> Albert
>
>
> On Jun 20, 2006, at 4:52 PM, Ray Hauge wrote:
>
> > On Tuesday 20 June 2006 15:28, Adam Zey wrote:
> >> Ray Hauge wrote:
> >>> On Tuesday 20 J
Thanks everyone. Always nice to know there is more than one direction
to go in.
Albert
On Jun 20, 2006, at 4:52 PM, Ray Hauge wrote:
On Tuesday 20 June 2006 15:28, Adam Zey wrote:
Ray Hauge wrote:
On Tuesday 20 June 2006 15:14, Albert Padley wrote:
I have a regular for loop - for($i=1; $
On Tuesday 20 June 2006 15:28, Adam Zey wrote:
> Ray Hauge wrote:
> > On Tuesday 20 June 2006 15:14, Albert Padley wrote:
> >> I have a regular for loop - for($i=1; $i<100; $i++)
> >>
> >> Within the loop I need to create variables named:
> >>
> >> $p1name;
> >> $p2name;
> >> $p3name;
> >> etc.
> >
Are you sure that you don't want an array? Arrays are normally much
better for this type of thing.
That said,
${"p{$i}name"} = 'foo';
David
Albert Padley wrote:
> I have a regular for loop - for($i=1; $i<100; $i++)
>
> Within the loop I need to create variables named:
>
> $p1name;
> $p2name;
Ray Hauge wrote:
On Tuesday 20 June 2006 15:14, Albert Padley wrote:
I have a regular for loop - for($i=1; $i<100; $i++)
Within the loop I need to create variables named:
$p1name;
$p2name;
$p3name;
etc.
The integer portion of each variable name needs to be the value of $i.
I can't seem to ge
for($i=1; $i<100; $i++) {
${'p'.$i.'name'} = 'whatever';
}
- jeff
On 20-Jun-06, at 6:14 PM, Albert Padley wrote:
I have a regular for loop - for($i=1; $i<100; $i++)
Within the loop I need to create variables named:
$p1name;
$p2name;
$p3name;
etc.
The integer portion of each variable
On Tuesday 20 June 2006 15:14, Albert Padley wrote:
> I have a regular for loop - for($i=1; $i<100; $i++)
>
> Within the loop I need to create variables named:
>
> $p1name;
> $p2name;
> $p3name;
> etc.
>
> The integer portion of each variable name needs to be the value of $i.
>
> I can't seem to ge
I have a regular for loop - for($i=1; $i<100; $i++)
Within the loop I need to create variables named:
$p1name;
$p2name;
$p3name;
etc.
The integer portion of each variable name needs to be the value of $i.
I can't seem to get my syntax correct?
Can someone point me in the right direction?
Tha
ot; <[EMAIL PROTECTED]>
Sent: Wednesday, December 08, 2004 3:41 PM
Subject: [PHP] For Loop
I have a question about the following code:
**
$months_arr = array("JAN", "FEB", "MAR", "APR", "MAY", "JUN&qu
ed PM 04:41:00 EST
> To: "'PHP general'" <[EMAIL PROTECTED]>
> Subject: [PHP] For Loop
>
> I have a question about the following code:
>
> **
>
> $months_arr = array("JAN", "FEB", &
What happens is (if I understand it correctly):
First, PHP sets $i to equal 0, and then immediately sets $i to
$months_arr_length.
Every time the loop executes, it resets $1 to $months_arr_length, so
you are stuck in an infinite loop.
The reason behind this is you are using assignment equals (=
I have a question about the following code:
**
$months_arr = array("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG",
"SEP", "OCT", "NOV", "DEC");
$months_arr_length = count($months_arr);
for($i = 0; $i = $months_arr_length; $i++){
echo $m
[EMAIL PROTECTED] wrote:
Hello Everyone,
I'm building a hotel management system and I can't seem to figure out why my
for() loop doesn't work the way it should. I'm using patTemplate to create
the HTML Template (I like using it and I don't want to start a pro/con
template war). Here is the script:
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> for ($j = 0; $j < 32; $j++) {
> for ($i = 0; $i < count($num_days); $i++) {
> $template->addVar("room_num", "ROOM_NUM", '101');
> $template->addVar("room_type", "ROOM_TYPE", 'NQQ');
> $template->addVar("gues
Hello Everyone,
I'm building a hotel management system and I can't seem to figure out why my
for() loop doesn't work the way it should. I'm using patTemplate to create
the HTML Template (I like using it and I don't want to start a pro/con
template war). Here is the script:
for ($j = 0; $j < 32; $
AIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, 25 September, 2003 12:26
Subject: Re: [PHP] for loop break and continue
Can't you let me have a shred of programming self-respect?
Rich (I should have cracked the book) Fox
> On Thu, 2003-09-25 at 12:04, Rich Fox wrote:
> >
[snip]
Can't you let me have a shred of programming self-respect?
Rich (I should have cracked the book) Fox
[/snip]
Nah, too easy! :) We all get bumped from time to time
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Can't you let me have a shred of programming self-respect?
Rich (I should have cracked the book) Fox
> On Thu, 2003-09-25 at 12:04, Rich Fox wrote:
> > DOH!
> >
> > This is a new addition to PHP because it wasn't there before!
> >
> > Thanks for the slap.
>
> PHP has supported break for as long a
On Thu, 2003-09-25 at 12:04, Rich Fox wrote:
> DOH!
>
> This is a new addition to PHP because it wasn't there before!
>
> Thanks for the slap.
PHP has supported break for as long as I can remember which goes back to
about 1999 and PHP 3.something.
Cheers,
Rob.
--
.
DOH!
This is a new addition to PHP because it wasn't there before!
Thanks for the slap.
"Robert Cummings" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Take the sample code below, paste it to a PHP file, add a real
> conditional, execute script. Voila, you've taken the first ste
Take the sample code below, paste it to a PHP file, add a real
conditional, execute script. Voila, you've taken the first step towards
helping yourself.
Cheers,
Rob.
On Thu, 2003-09-25 at 11:42, Rich Fox wrote:
> Hi,
> Is there an equivalent to the C++ 'break' command to stop execution of a for
Hi,
Is there an equivalent to the C++ 'break' command to stop execution of a for
loop? I know I can use 'goto' but I don't want to unless I have to.
for ($i=0; $i<$n; $i++)
if (some condition)
break;
And, what about 'continue' which skips the rest of the code in the for loop
and immed
[snip]
I need to grab five pages from a web site every day and then FTP those
pages
to another site.
I was wondering if I should grab all five pages (and store them
somewhere)
and then FTP all five.
[/snip]
This sounds like the more prudent move as it is more efficient. You can
also confirm that
Hi all,
You can probably tell I'm pretty new at this.
I need to grab five pages from a web site every day and then FTP those pages
to another site.
I was wondering if I should grab all five pages (and store them somewhere)
and then FTP all five.
Or if I could keep the FTP connection open while
I think you add square brackets:
so you'd have an array with a numeric key (0-n) and the value of the key
would be the value of the input.
or perhaps you'd prefer
in this case the key of the array would be 'Hepb_ag', and the value would be
true (1).
In both cases, I don't think anything is
Good Morning all
I need some help as to how to print this array, its input name is labtype
and they all have differnet values.
Amylase
Cholesterol
CMV Ab IgM/G
GLUCOSE - Fasting
GLUCOSE - Random
Hepatitus B S Ag
On the page I created if the person selects any of these then it should
submit it a
Try a foreach... it works well...
-Original Message-
From: Lars Torben Wilson [mailto:[EMAIL PROTECTED]] On Behalf Of Lars
Torben Wilson
Sent: Saturday, March 30, 2002 4:38 PM
To: David Johansen
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] For Loop going too long
On Sat, 2002-03-30 at 15:40
On Sat, 2002-03-30 at 15:40, David Johansen wrote:
> I have a question about something weird that I've noticed Here's some code
> that I have that loads up
>
>$sql = "SELECT * FROM pickup_times WHERE DAYOFMONTH(time0_name) =
> $dayofmonth";
>
>$result = mysql_query($sql, $dbh);
>$day
I have a question about something weird that I've noticed Here's some code
that I have that loads up
$sql = "SELECT * FROM pickup_times WHERE DAYOFMONTH(time0_name) =
$dayofmonth";
$result = mysql_query($sql, $dbh);
$day = mysql_fetch_array($result);
for ($i=0; $i";
When I do this i
On Wed, 20 Mar 2002, Kris Vose wrote:
> I have a problem with a piece of code that uses the mail function in a
> for loop. It sends out mail to all the users in the database but it has
> a problem with attaching their specific name into the message. What
> happens is the first user in the databa
}//end of for
}//end of if
*
* Cal Evans
* Techno-Mage
* http://www.calevans.com
*
- Original Message -
From: "Kris Vose" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 20, 2002 2:07 PM
Subject: [PHP] for loop problem
I have a problem with a piec
*
- Original Message -
From: "Kris Vose" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 20, 2002 2:07 PM
Subject: [PHP] for loop problem
I have a problem with a piece of code that uses the mail function in a for
loop. It sends out mail to all the
I have a problem with a piece of code that uses the mail function in a for loop. It
sends out mail to all the users in the database but it has a problem with attaching
their specific name into the message. What happens is the first user in the database
will get their name in the e-mail (Dear
Tyler Longren wrote:
>
> Here's something interesting though. There's an id field that's set to
> AUTO_INCREMENT.
Yep, and that's one thing I've been looking at. See, I find it strange
that you need an KEY idpass (id, passcode(245)) when the ID is
quaranteed to be unique in itself.
Funny...
>work.
>
>Tyler
>
>- Original Message -
>From: "John Steele" <[EMAIL PROTECTED]>
>To: "PHP General List" <[EMAIL PROTECTED]>
>Sent: Monday, November 12, 2001 3:33 PM
>Subject: Re: [PHP] for loop problem?
>
>
>&g
> work.
>
> Tyler
>
> - Original Message -
> From: "John Steele" <[EMAIL PROTECTED]>
> To: "PHP General List" <[EMAIL PROTECTED]>
> Sent: Monday, November 12, 2001 3:33 PM
> Subject: Re: [PHP] for loop problem?
>
>
> > Hi Ty
this PHP SHOULD
work.
Tyler
- Original Message -
From: "John Steele" <[EMAIL PROTECTED]>
To: "PHP General List" <[EMAIL PROTECTED]>
Sent: Monday, November 12, 2001 3:33 PM
Subject: Re: [PHP] for loop problem?
> Hi Tyler,
>
> This doesn't s
t;
>Shouldn't the ID's be further apart than that? Know what I'm saying?
>
>Tyler
>
>- Original Message -
>From: "Martin Towell" <[EMAIL PROTECTED]>
>To: "'Tyler Longren'" <[EMAIL PROTECTED]>; "Jack Dempsey"
>&
r Longren'" <[EMAIL PROTECTED]>; "Jack Dempsey"
<[EMAIL PROTECTED]>
Cc: "PHP-General" <[EMAIL PROTECTED]>
Sent: Monday, November 12, 2001 10:45 PM
Subject: RE: [PHP] for loop problem?
> How about changing the logic lightly? try this:
>
>
bers then adding it back on
later
Martin T
-Original Message-
From: Tyler Longren [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 3:38 PM
To: Jack Dempsey
Cc: PHP-General
Subject: Re: [PHP] for loop problem?
I've ran it a few times without the MySQL code in there. Runs
x27;passcodes' field.
Oh well, here I come perl!
Thanks,
Tyler
- Original Message -
From: "Jack Dempsey" <[EMAIL PROTECTED]>
To: "Tyler Longren" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, November 12, 2001 10:43 PM
Subject: RE: [
loop problem?
Exact code:
".mysql_error()."";
exit;
}
}
mysql_close($connection);
?>
Tyler
- Original Message -
From: "Jack Dempsey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 12, 2001 10:34 PM
Subject: RE: [PHP] for loop
Exact code:
".mysql_error()."";
exit;
}
}
mysql_close($connection);
?>
Tyler
- Original Message -
From: "Jack Dempsey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 12, 2001 10:34 PM
Subject: RE: [PHP] for loop problem?
paste the complete code in and myself and others can run your exact copy
-Original Message-
From: Tyler Longren [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 12, 2001 11:22 PM
To: Martin Towell; [EMAIL PROTECTED]
Subject: Re: [PHP] for loop problem?
I removed all of the quotes that
Sent: Monday, November 12, 2001 10:06 PM
Subject: RE: [PHP] for loop problem?
> hmmm... I just tried :
>
> $value1 = 100;
> $value2 = 1223109;
> for($i = $value1; $i <= $value2; $i++)
> {
> echo "$i\n";
> }
>
> and it spat out all 223109 numbers
e-
From: Tyler Longren [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 2:53 PM
To: Evan Nemerson; [EMAIL PROTECTED]
Subject: Re: [PHP] for loop problem?
To everyone that said it had something to do with the quotes:
that has nothing to do with it.
When I first wrote this, It didn
I HAVE to, I'll do this in PERL,
but would much rather do it in PHP.
Thanks everyone,
Tyler
- Original Message -
From: "Evan Nemerson" <[EMAIL PROTECTED]>
To: "Tyler Longren" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, November 12, 200
My word why all the quotes?
".mysql_error()."";
exit;
}
}
mysql_close($connection);
?>
That should give you some better results.
On Monday 12 November 2001 07:32 pm, you wrote:
> Hello everyone,
>
> I have a pretty big list of codes that need to be put into a mysql db. The
> numbers range
PROTECTED]]
Sent: Tuesday, November 13, 2001 2:33 PM
To: PHP-General
Subject: [PHP] for loop problem?
Hello everyone,
I have a pretty big list of codes that need to be put into a mysql db. The
numbers range from 100 to 1223109. Here's the PHP I wrote to put these
codes int
Hello everyone,
I have a pretty big list of codes that need to be put into a mysql db. The
numbers range from 100 to 1223109. Here's the PHP I wrote to put these
codes into a database:
".mysql_error()."";
exit;
}
}
mysql_close($connection);
?>
Everytime I run this from a browser, it ju
From: "Michael Gerholdt" <[EMAIL PROTECTED]>
> I want the week and month days to have leading zeros - how can I make the
> new environment replicate the old?
Loop using the numeric but use printf for the formatting (which is really
what you should have used originally). Refer to the manual for t
In PHP Version 4.0.3pl1
for ($i='01';$i<=12;$i++)
the increment used to produce
01
02
03
...
09
10
11
12
but in
PHP Version 4.0.6
the identical script
for ($i='01';$i<=12;$i++)
produces:
01
2
3
...
9
10
11
12
I want the week and month days to have leading zeros - how can I make the
new e
62 matches
Mail list logo