On 22 Jul 2013 at 12:56, Karl-Arne Gjersøyen karlar...@gmail.com wrote:
Yes, i know that only one a singe row is updated and that is the problem.
What can I do to update several rows at the same time?
Which several rows? The row that will be updated is that (or those) that match
your WHERE
2013/7/22 Tim Streater t...@clothears.org.uk
On 22 Jul 2013 at 12:56, Karl-Arne Gjersøyen karlar...@gmail.com wrote:
Yes, i know that only one a singe row is updated and that is the problem.
What can I do to update several rows at the same time?
Which several rows? The row that will be
On 3/12/2013 9:04 PM, Angela Barone wrote:
On Mar 12, 2013, at 5:16 PM, David Robley wrote:
Presumably there is a fixed list of State - those are US states? -
so why not provide a drop down list of the possible choices?
There is, but the problem must have been that if someone
On Wed, Mar 13, 2013 at 5:07 PM, Jim Giner jim.gi...@albanyhandball.comwrote:
On 3/12/2013 9:04 PM, Angela Barone wrote:
On Mar 12, 2013, at 5:16 PM, David Robley wrote:
Presumably there is a fixed list of State - those are US states? -
so why not provide a drop down list of the possible
On Mar 13, 2013, at 9:07 AM, Jim Giner wrote:
Why not just check if the $state exists as a key of the array $states before
doing this?
Jim,
Are you thinking about the in_array function?
Angela
On Thu, Mar 14, 2013 at 12:18 AM, Angela Barone ang...@italian-getaways.com
wrote:
On Mar 13, 2013, at 9:07 AM, Jim Giner wrote:
Why not just check if the $state exists as a key of the array $states
before doing this?
Jim,
Are you thinking about the in_array function?
Angela
On Mar 13, 2013, at 4:24 PM, Matijn Woudt wrote:
That wouldn't work, in_array checks the values, and your states are in the
keys. Use:
if(isset($states[$state]))
Hi Matijn,
Before I received your email, I ran across if(array_key_exists) and it
seems to work. How does that differ
On Wed, Mar 13, 2013 at 4:44 PM, Angela Barone
ang...@italian-getaways.comwrote:
I ran across if(array_key_exists) and it seems to work. How does that
differ from if(isset($states[$state]))?
Hi Angela,
isset() will return false for an array key 'foo' mapped to a null value
whereas
2013/3/14 David Harkness davi...@highgearmedia.com
On Wed, Mar 13, 2013 at 4:44 PM, Angela Barone
ang...@italian-getaways.comwrote:
I ran across if(array_key_exists) and it seems to work. How does that
differ from if(isset($states[$state]))?
Hi Angela,
isset() will return false for
On Wed, Mar 13, 2013 at 5:10 PM, Sebastian Krebs krebs@gmail.comwrote:
Because 'null' is the representation of nothing array_key_exists() and
isset() can be treated as semantically equivalent.
As I said, these functions return different results for null values. It
won't matter for Angela
2013/3/14 David Harkness davi...@highgearmedia.com
On Wed, Mar 13, 2013 at 5:10 PM, Sebastian Krebs krebs@gmail.comwrote:
Because 'null' is the representation of nothing array_key_exists() and
isset() can be treated as semantically equivalent.
As I said, these functions return
On Mar 13, 2013, at 5:02 PM, David Harkness wrote:
isset() will return false for an array key 'foo' mapped to a null value
whereas array_key_exists() will return true. The latter asks Is this key in
the array? whereas isset() adds and is its value not null? While isset()
is
I've been getting the following error for awhile now, but I can't
figure out why it's happening:
Invalid argument supplied for foreach() in ... sample.php on line 377
Here's that portion of code:
include(states_zipcodes.php);
// Check if Zip Code matches from states_zipcodes
Am 12.03.13 20:45, schrieb Angela Barone:
I've been getting the following error for awhile now, but I can't
figure out why it's happening:
Invalid argument supplied for foreach() in ... sample.php on line 377
Here's that portion of code:
include(states_zipcodes.php);
//
On Mar 12, 2013, at 2:26 PM, Marco Behnke wrote:
what is in $states?
Looks like $states[$state] is not an array.
Here's a sample:
?php
$states = array(
'AL' = array( '350','351','352','353', ),
'AK' = array( '995','996','997','998','999', ),
'AZ' = array(
$states = array(
'AL' = array( '350','351','352','353', ),
'AK' = array( '995','996','997','998','999', ),
'AZ' = array( '850','851','852','853','854', ),
...
'WI' = array( '530','531','532', ),
'WY' = array( '820','821','822','823','824', ),
);
?
Seeing
I think I figured it out.
?php
$states = array(
'AL' = array( '350','351','352','353', ),
'AK' = array( '995','996','997','998','999', ),
'AZ' = array( '850','851','852','853','854', ),
'WI' = array( '530','531','532', ),
'WY' = array( '820','821','822','823','824',
Angela Barone wrote:
I think I figured it out.
?php
$states = array(
'AL' = array( '350','351','352','353', ),
'AK' = array( '995','996','997','998','999', ),
'AZ' = array( '850','851','852','853','854', ),
'WI' = array( '530','531','532', ),
'WY' = array(
On Mar 12, 2013, at 5:16 PM, David Robley wrote:
Presumably there is a fixed list of State - those are US states? -
so why not provide a drop down list of the possible choices?
There is, but the problem must have been that if someone didn't select
a State, $state was blank. I've
I don't know about others, but I can't make sense of this - way too much
presented with no idea of what I am looking at - code or output.
One thing: $_Request is not the same var as $_REQUEST.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
On 4/5/2012 4:15 PM, Ethan Rosenberg wrote:
Dear Lists -
I know I am missing something fundamental - but I have no idea where to start to
look.
Here are code snippets:
I have truncated the allowed_fields to make it easier to debug.
$allowed_fields = array( 'Site' ='POST[Site]', 'MedRec' =
On Sat, Jan 7, 2012 at 5:01 PM, Tim Behrendsen t...@behrendsen.com wrote:
The first loop is leaving a reference to the final element. But then the
second foreach is doing a straight assignment to the $row variable, but
$row is a reference to the final element. So the foreach is assigning its
On 1/9/2012 10:35 AM, David Harkness wrote:
On Sat, Jan 7, 2012 at 5:01 PM, Tim Behrendsen t...@behrendsen.com
mailto:t...@behrendsen.com wrote:
The first loop is leaving a reference to the final element. But
then the second foreach is doing a straight assignment to the $row
...@gmail.com
Sent: Sunday, January 8, 2012 3:01 AM
Subject: Re: [PHP] Strange foreach reference issue
On 1/7/2012 4:44 PM, Stephen wrote:
On 12-01-07 07:30 PM, Tim Behrendsen wrote:
When you use an ampersand on the variable, that creates a reference to the
array elements, allowing you to potentially
Hello,
This sure looks like a bug, but maybe there's some subtlety going on
that I don't understand, so I would appreciate some insight. After much
debugging, I tracked down a bug in my code to this test program. My PHP
version is 5.3.3, running under Fedora Linux.
?php
$row_list =
I cut and pasted your code and got the same result.
I flipped the two foreach blocks and got the expected results.
I deleted the first block and copied the second, then updated the
string. I got this. I can't explain.
?php
$row_list = array(
array(
'Title' = 'Title
On Sun, Jan 8, 2012 at 12:29 AM, Tim Behrendsen t...@behrendsen.com wrote:
Hello,
This sure looks like a bug, but maybe there's some subtlety going on that I
don't understand, so I would appreciate some insight. After much debugging,
I tracked down a bug in my code to this test program. My
On 1/7/2012 4:18 PM, Matijn Woudt wrote:
On Sun, Jan 8, 2012 at 12:29 AM, Tim Behrendsent...@behrendsen.com wrote:
Hello,
This sure looks like a bug, but maybe there's some subtlety going on that I
don't understand, so I would appreciate some insight. After much debugging,
I tracked down a
On 12-01-07 07:30 PM, Tim Behrendsen wrote:
When you use an ampersand on the variable, that creates a reference to
the array elements, allowing you to potentially change the array
elements themselves (which I'm not doing here).
http://www.php.net/manual/en/control-structures.foreach.php
I
On 1/7/2012 4:44 PM, Stephen wrote:
On 12-01-07 07:30 PM, Tim Behrendsen wrote:
When you use an ampersand on the variable, that creates a reference
to the array elements, allowing you to potentially change the array
elements themselves (which I'm not doing here).
-Original Message-
From: Jonathan Sachs [mailto:081...@jhsachs.com]
Sent: 20 October 2010 04:48
To: php-general@lists.php.net
Subject: [PHP] Possible foreach bug; seeking advice to isolate the
problem
I've got a script which originally contained the following piece of
code
On 20/10/2010 05:47, Jonathan Sachs wrote:
I've got a script which originally contained the following piece of
code:
foreach ( $objs as $obj ) {
do_some_stuff($obj);
}
When I tested it, I found that on every iteration of the loop the last
element of $objs was assigned the value of the
I've got a script which originally contained the following piece of
code:
foreach ( $objs as $obj ) {
do_some_stuff($obj);
}
When I tested it, I found that on every iteration of the loop the last
element of $objs was assigned the value of the current element. I was
able to step through the
At 3:46 PM -0400 6/10/10, Paul M Foster wrote:
On Thu, Jun 10, 2010 at 11:16:08AM -0400, tedd wrote:
I spend much of my time thinking Did I do that before?
grin I know the feeling. I will say this, though. I have yet to figure
out, from your URLs, how your site(s) is/are organized. Maybe a
At 7:19 AM +0530 6/10/10, Shreyas wrote:
PHP'ers,
I am reading a PHP book which explains foreach and at the end says : *'When
foreach starts walking through an array, it moves the pointer to
the beginning of the array. You don't need to reset an array before
walking through it with foreach.'*
*
On Thu, Jun 10, 2010 at 07:03:28AM -0400, tedd wrote:
At 7:19 AM +0530 6/10/10, Shreyas wrote:
PHP'ers,
I am reading a PHP book which explains foreach and at the end says : *'When
foreach starts walking through an array, it moves the pointer to
the beginning of the array. You don't need to
All,
I tried and tested it but wanted a solid confirmation on it. I felt foreach
usage is better than manual way of next(), prev() et al.
Thanks for the comments. I consider the thread answered and solved unless
someone has anything more to add.
Regards,
Shreyas
On Thu, Jun 10, 2010 at 7:02
At 9:32 AM -0400 6/10/10, Paul M Foster wrote:
On Thu, Jun 10, 2010 at 07:03:28AM -0400, tedd wrote:
This is one of those questions that you can test very easily, just
initialize an array and try it.
+1
This is Tedd's modus operandi. His website(s) are full of exactly this
type of thing.
On Thu, Jun 10, 2010 at 11:16:08AM -0400, tedd wrote:
At 9:32 AM -0400 6/10/10, Paul M Foster wrote:
On Thu, Jun 10, 2010 at 07:03:28AM -0400, tedd wrote:
This is one of those questions that you can test very easily, just
initialize an array and try it.
+1
This is Tedd's modus
From: Paul M Foster
On Thu, Jun 10, 2010 at 11:16:08AM -0400, tedd wrote:
At 9:32 AM -0400 6/10/10, Paul M Foster wrote:
On Thu, Jun 10, 2010 at 07:03:28AM -0400, tedd wrote:
Paul:
Now, if I could get the old memory to lock in and remember it, it
would be great!
I spend much of my
On Thursday 10 June 2010 11:16:08 tedd wrote:
At 9:32 AM -0400 6/10/10, Paul M Foster wrote:
On Thu, Jun 10, 2010 at 07:03:28AM -0400, tedd wrote:
This is one of those questions that you can test very easily, just
initialize an array and try it.
+1
This is Tedd's modus operandi.
PHP'ers,
I am reading a PHP book which explains foreach and at the end says : *'When
foreach starts walking through an array, it moves the pointer to
the beginning of the array. You don’t need to reset an array before
walking through it with foreach.'*
*
*
*Does this mean - *
*1) Before I
On Wed, Jun 9, 2010 at 9:49 PM, Shreyas shreya...@gmail.com wrote:
PHP'ers,
I am reading a PHP book which explains foreach and at the end says : *'When
foreach starts walking through an array, it moves the pointer to
the beginning of the array. You don’t need to reset an array before
Shreyas wrote:
PHP'ers,
I am reading a PHP book which explains foreach and at the end says : *'When
foreach starts walking through an array, it moves the pointer to
the beginning of the array. You don’t need to reset an array before
walking through it with foreach.'*
*
*
*Does this mean - *
*1)
On Wed, Jun 9, 2010 at 21:49, Shreyas shreya...@gmail.com wrote:
PHP'ers,
I am reading a PHP book which explains foreach and at the end says : *'When
foreach starts walking through an array, it moves the pointer to
the beginning of the array. You don’t need to reset an array before
walking
On Tue, 2009-08-11 at 16:00 -0400, Eddie Drapkin wrote:
On Tue, Aug 11, 2009 at 3:56 PM, teddtedd.sperl...@gmail.com wrote:
At 12:44 PM -0700 8/11/09, Ben Dunlap wrote:
This is probably flame-war tinder, so I'll try to tread more delicately in
the future. Next you know we'll be on the
On Tue, 2009-08-11 at 16:23 -0400, Rick Duval wrote:
OK, first guys, I'm sorry to have to do this but I can't get off this list!!!
I've followed the instructions on a couple of occasions (the ones at
the bottom of every email):
PHP General Mailing List (http://www.php.net/)
To
Do *NOT* get into the habit of outputting your HTML using echo or print
statements, it becomes unmaintainable very quickly, use a templating
language, ether with a framework(recomended) or standalone.
You should learn the basics of HTML and CSS, go and read
http://htmldog.com/, btw to add a
On Tue, 2009-08-11 at 07:13 +, hessi...@hessiess.com wrote:
Do *NOT* get into the habit of outputting your HTML using echo or print
statements, it becomes unmaintainable very quickly, use a templating
language, ether with a framework(recomended) or standalone.
You should learn the basics
On Aug 11, 2009, at 12:13 AM, hessi...@hessiess.com wrote:
Do *NOT* get into the habit of outputting your HTML using echo or
print
statements, it becomes unmaintainable very quickly, use a templating
language, ether with a framework(recomended) or standalone.
This sounds interesting.
statements, it becomes unmaintainable very quickly, use a templating
language, ether with a framework(recomended) or standalone.
But he /is/ using a templating language... PHP. ;-)
Ben
Ben Dunlap wrote:
statements, it becomes unmaintainable very quickly, use a templating
language, ether with a framework(recomended) or standalone.
But he /is/ using a templating language... PHP. ;-)
Keep telling yourself that... and be sure to pat your own back.
Cheers,
Rob.
--
= str_replace(if, ?php if, $this-str);
$this-str = str_replace(eif~, ?php endif;?, $this-str);
// Expand loop macro
$this-str = str_replace(loop, ?php foreach, $this-str);
$this-str = str_replace(eloop~, ?php endforeach;?,
$this-str);
// Expand display macro
$this-str
statements, it becomes unmaintainable very quickly, use a templating
language, ether with a framework(recomended) or standalone.
But he /is/ using a templating language... PHP. ;-)
Keep telling yourself that... and be sure to pat your own back.
I'm sure there are plenty of situations
At 12:44 PM -0700 8/11/09, Ben Dunlap wrote:
This is probably flame-war tinder, so I'll try to tread more delicately in
the future. Next you know we'll be on the ternary operator and which is
better, Mac or Windows. ;-)
Ben
That was won long ago, it's Mac. :-)
Cheers,
tedd
--
---
On Tue, Aug 11, 2009 at 3:56 PM, teddtedd.sperl...@gmail.com wrote:
At 12:44 PM -0700 8/11/09, Ben Dunlap wrote:
This is probably flame-war tinder, so I'll try to tread more delicately in
the future. Next you know we'll be on the ternary operator and which is
better, Mac or Windows. ;-)
Ben
Allen, you off and running again?
Sure am, thanks, on to the next set of issues. Seems like
programming is always moving on from one error to the next :)
Currently, I am having trouble with echo and php line-returns.
It works on one part of the code, but not on another (instead,
prints
OK, first guys, I'm sorry to have to do this but I can't get off this list!!!
I've followed the instructions on a couple of occasions (the ones at
the bottom of every email):
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Been There, done
Let me be the first to welcome you to the list!!!
Rick Duval wrote:
OK, first guys, I'm sorry to have to do this but I can't get off this list!!!
I've followed the instructions on a couple of occasions (the ones at
the bottom of every email):
PHP General Mailing List (http://www.php.net/)
On Aug 10, 2009, at 3:43 PM, Jim Lucas wrote:
Allen McCabe wrote:
I am creating an order form for tickets for a list of performances
at a
performing arts center.
Currently, the form is on paper, and is set up as follows:
-Nutcracker - Tues 10/13 - 11am - $4.00
Thanks for letting us know
/23/2009';
$show_02['time'] = '11am';
$show_02['price'] = 4.00;
$show_02['soldout'] = 0; //IF THE SHOW SELLS OUT, CHANGE 0 to 1
(without quotations).
[/code]
And here are the foreach loops I'm trying to build the rows with:
[code=order.php]
?php
foreach ($shows as $key = $value
I can't seem to get my foreach loops to work, will PHP parse
embedded loops?
yes.
Is this something I need to have in a database to work?
no, you can do it with the arrays... but it may be easier to work
with over the long run if that data was in a db.
Anyway right after you finish
John,
I did this, and got my arrays dumped (on one line). After adding line
returns, here is a snippet:
[code=array dump]
array(38) {
[show_01]= array(5) {
[title]= string(29) Van Cliburn Gold Medal Winner
[date]= string(16) Tues. 10/13/2009
[time]= string(4) 11am
[price]= float(4)
[soldout]=
I did this, and got my arrays dumped (on one line). After adding
line returns, here is a snippet:
it looks OK. Note that you can see (copy/paste) that array which you
just dumped, much better, if you view the source code of the html
page. OR you can use pre to make that format persist
I am using the print function to display my html. I cannot get the line
return ( \n ) character to actually push the html onto the next line, it
just gets displayed instead. Should I be using echo?
On Mon, Aug 10, 2009 at 3:41 PM, John Butler
govinda.webdnat...@gmail.comwrote:
I did this,
$shows = array();
$show_01 = array();
$show_01['title'] = 'Van Cliburn Gold Medal Winner';
$show_01['date'] = 'Tues. 10/13/2009';
$show_01['time'] = '11am';
$show_01['price'] = 4.00;
$show_01['soldout'] = 0; //IF THE SHOW SELLS OUT, CHANGE 0 to 1
(without quotations).
You're not using the pre and /pre tag most likely then.
-Original Message-
From: Allen McCabe [mailto:allenmcc...@gmail.com]
Sent: Monday, August 10, 2009 4:11 PM
To: John Butler
Cc: phpList
Subject: Re: [PHP] Embedding foreach loops
I am using the print function to display my
I am using the print function to display my html. I cannot get the line
return ( \n ) character to actually push the html onto the next line, it
just gets displayed instead. Should I be using echo?
In the PHP code snippet you pasted above, you're using single-quotes
to delimit your literal
I am using the print function to display my html. I cannot get the
line return ( \n ) character to actually push the html onto the next
line, it just gets displayed instead. Should I be using echo?
Allen, you off and running again?
echo blah.. \n; //-- this will print the literal 'blah..
Tim | iHostNZ schrieb:
Hi All,
Just to annoy the hell out of you, another thing that has been on my mind
for a while:
I love the foreach ($ar as $k = $v) { ... } construct and use it all the
time. However, I read somewhere that foreach actually uses a copy of $ar
instead of the array itself by
Tim | iHostNZ wrote:
Hi All,
Just to annoy the hell out of you, another thing that has been on my mind
for a while:
I love the foreach ($ar as $k = $v) { ... } construct and use it all the
time. However, I read somewhere that foreach actually uses a copy of $ar
instead of the array
On Jan 1, 2008, at 11:59 AM, Martin Jerga wrote:
Hello,
the problem is in this part of code $key - $value
This notation means that you are trying to access property $value on
the object $key.
Just replace it with $key = $value and you will get the result as
expected.
Martin J
Thank
Hello,
the problem is in this part of code $key - $value
This notation means that you are trying to access property $value on the
object $key.
Just replace it with $key = $value and you will get the result as expected.
Martin J
jekillen wrote / napísal(a):
Hello;
I have this section of
Hit send too soon. Sorry!
On Tue, January 1, 2008 2:05 pm, jekillen wrote:
Several questions:
How long can an index be in an associative array? (the indexes I
use
in this array are 32 character hashes)
As far as I know, it can be as big as your RAM will hold...
Can it start with a number
On Jan 1, 2008, at 3:34 PM, Richard Lynch wrote:
Hit send too soon. Sorry!
On Tue, January 1, 2008 2:05 pm, jekillen wrote:
Several questions:
How long can an index be in an associative array? (the indexes I
use
in this array are 32 character hashes)
As far as I know, it can be as big as
On Fri, 2007-11-30 at 14:46 -0500, Robert Cummings wrote:
This is dangerous use of the array functions. A problem occurs when you
have a value that evaluates to false (such as the first entry in the
example array :). In fact the only way to ensure you traverse the array
properly is to use
On Fri, 2007-11-30 at 09:51 -0800, Jim Lucas wrote:
Jeffery Fernandez wrote:
Hi all,
Is it possible to rewind a foreach loop? eg:
$numbers = array(0,1,2,3,4,5,6,7,8,9,10);
foreach ($numbers as $index = $value)
{
if ($value == 5)
{
Jeffery Fernandez wrote:
Hi all,
Is it possible to rewind a foreach loop? eg:
$numbers = array(0,1,2,3,4,5,6,7,8,9,10);
foreach ($numbers as $index = $value)
{
if ($value == 5)
{
prev($numbers);
}
echo Value: $value . PHP_EOL;
}
The above
Jeffery Fernandez wrote:
Hi all,
Is it possible to rewind a foreach loop? eg:
$numbers = array(0,1,2,3,4,5,6,7,8,9,10);
foreach ($numbers as $index = $value)
{
if ($value == 5)
{
prev($numbers);
}
echo Value: $value . PHP_EOL;
}
Hi all,
Is it possible to rewind a foreach loop? eg:
$numbers = array(0,1,2,3,4,5,6,7,8,9,10);
foreach ($numbers as $index = $value)
{
if ($value == 5)
{
prev($numbers);
}
echo Value: $value . PHP_EOL;
}
The above doesn't seem to work. In one of
I think the best option for me is to refactorise my code a bit to cater to my
situation. Thanks all for your help.
Jeffery
On Fri, 30 Nov 2007 02:32:11 pm Jeffery Fernandez wrote:
On Fri, 30 Nov 2007 02:13:52 pm Chris wrote:
Jeffery Fernandez wrote:
On Fri, 30 Nov 2007 02:01:47 pm Chris
$keys = array_values($array);
for ($i=0; $icount($keys); $i++) {
if ($keys[$i] == 5)
$i -= 2;
}
Untested, but should work.
On Nov 29, 2007, at 7:13 PM, Chris [EMAIL PROTECTED] wrote:
Jeffery Fernandez wrote:
On Fri, 30 Nov 2007 02:01:47 pm Chris wrote:
Jeffery Fernandez wrote:
At 2:11 PM +1100 11/30/07, Jeffery Fernandez wrote:
On Fri, 30 Nov 2007 02:01:47 pm Chris [EMAIL PROTECTED] wrote:
Jeffery Fernandez wrote:
Hi all,
Is it possible to rewind a foreach loop? eg:
$numbers = array(0,1,2,3,4,5,6,7,8,9,10);
foreach ($numbers as $index = $value)
{
Jeffery Fernandez wrote:
Hi all,
Is it possible to rewind a foreach loop? eg:
$numbers = array(0,1,2,3,4,5,6,7,8,9,10);
foreach ($numbers as $index = $value)
{
if ($value == 5)
{
prev($numbers);
}
echo Value: $value . PHP_EOL;
}
The above
On Fri, 30 Nov 2007 02:01:47 pm Chris wrote:
Jeffery Fernandez wrote:
Hi all,
Is it possible to rewind a foreach loop? eg:
$numbers = array(0,1,2,3,4,5,6,7,8,9,10);
foreach ($numbers as $index = $value)
{
if ($value == 5)
{
prev($numbers);
Jeffery Fernandez wrote:
On Fri, 30 Nov 2007 02:01:47 pm Chris wrote:
Jeffery Fernandez wrote:
Hi all,
Is it possible to rewind a foreach loop? eg:
$numbers = array(0,1,2,3,4,5,6,7,8,9,10);
foreach ($numbers as $index = $value)
{
if ($value == 5)
{
On Fri, 30 Nov 2007 02:13:52 pm Chris wrote:
Jeffery Fernandez wrote:
On Fri, 30 Nov 2007 02:01:47 pm Chris wrote:
Jeffery Fernandez wrote:
Hi all,
Is it possible to rewind a foreach loop? eg:
$numbers = array(0,1,2,3,4,5,6,7,8,9,10);
foreach ($numbers as $index = $value)
{
On Mon, August 20, 2007 11:50 am, Sascha Braun, CEO @ fit-o-matic wrote:
could somebody please explain me, what loop construct is
faster? The for, while or foreach.
If you are doing anything where the speed of for/while/foreach
matters, you shouldn't have done that in PHP in the first place,
Hi people,
could somebody please explain me, what loop construct is
faster? The for, while or foreach.
I at the moment don't know if there are more.
And thanks to the person who is missusing the list here
for sending trojan horses everywhere.
Since I write to the PHP General list I am
On Mon, 2007-08-20 at 18:50 +0200, Sascha Braun, CEO @ fit-o-matic
wrote:
Hi people,
could somebody please explain me, what loop construct is
faster? The for, while or foreach.
I haven't bothered testing but I'd wager $5 that the following is the
fastest loop:
?php
while( 1 )
{
}
?
Thank you very much. When we might have time for testing we can
wager :))
Am Montag, den 20.08.2007, 13:21 -0400 schrieb Robert Cummings:
On Mon, 2007-08-20 at 18:50 +0200, Sascha Braun, CEO @ fit-o-matic
wrote:
Hi people,
could somebody please explain me, what loop construct is
It will probably work, and you could find out for sure by just trying it.
It might be better to construct a single query using things like:
$company_ids = implode(', ', $_POST['reporton_company']);
$query .= WHERE company_id IN ($company_ids) ;
This presumes you have already validated the
Have been wondering if this is possible
Basically I have 3 posted arrays,
$_POST['reporton_company'] (this can be various company id's. ie 3,6,7)
$_POST['report_period'] (this can be various periods but a max of 4
submitted. ie 3,4,5)
$_POST['questions_groups'] (this can be various -
foreach($_POST['reporton_company'] as $cmp_ind =$arrayd_cmp_id) {
foreach($_POST['report_period'] as $rep_ind =$arrayd_per_id) {
foreach($_POST['questions_groups'] as $group_ind =
$arrayd_group_no) {
mysql_select_db($database_name, $dname);
Why
Richard Lynch wrote:
Anyway, can you do *this* safely as a DOCUMENTED FEATURE:
foreach($array as $k = $v){
if (...) unset($array[$k]);
}
Well, somewhere in the said manual it is written that foreach operates
on a *copy* of the array, so you should be safe unsetting values in the
Since you didn't post how you created the array, I went ahead and (ugh!)
did it myself. This works fine.
?php
$elementsarr = Array ('knr', 'subject', 'title', 'kat', 'pages',
'access', 'dofile', MAX_FILE_SIZE, 'pdf', 'dolink', 'link', 'erstam',
'endless', 'from', 'until', 'openbem', 'history',
Not working.
foreach($_SESSION['skills'] as $key = $skill)
{
$query = INSERT INTO table (skill, sky, sku)
VALUES ('$skill',
{$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]});
//run query
}
The foreach is generating an invalid argument.
I'm just going to show again what I have
Felenstein [mailto:[EMAIL PROTECTED]
Sent: 18 October 2004 08:24
To: John Holmes; [EMAIL PROTECTED]
Subject: Re: [PHP] Nested foreach ?
Not working.
foreach($_SESSION['skills'] as $key = $skill)
{
$query = INSERT INTO table (skill, sky, sku)
VALUES ('$skill',
{$_SESSION['skys'][$key
Wish I had better news.
Warning: Invalid argument supplied for foreach() in
/home/lurkkcom/public_html/TestMultiTrans2.php on line
90
INSERT INTO LurkProfiles_Skicerts (ProfileID,
SkilCerts, NumYear, Lused) VALUES ()
line 90: foreach($skills as $key = $skill)
To confirm :
I changed to this:
to by several clients.
HTH
Graham
-Original Message-
From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
Sent: 18 October 2004 09:37
To: Graham Cossey; [EMAIL PROTECTED]
Subject: RE: [PHP] Nested foreach ?
Wish I had better news.
Warning: Invalid argument supplied for foreach
1 - 100 of 156 matches
Mail list logo