RE: [PHP] Nested foreach ?

2004-10-18 Thread Stuart Felenstein
Guess what , it's working ! The key (after yours and John's iteration lines) was adding these into the script: $skills = $_SESSION['skills']; $skys = $_SESSION['skys']; $slus = $_SESSION['slus']; A big thank you! to all who helped out here and for hanging in. Graham, thank you for continuing

Re: [PHP] Nested foreach ?

2004-10-17 Thread Robby Russell
On Sun, 2004-10-17 at 09:53 -0700, Stuart Felenstein wrote: I have 3 arrays. 3 for 3 fields in a table (all part of 1 record) array1 - field1 array2 - field2 array3 - field3 What I've been doing which works good with one array: if ( is_array( $_SESSION['foo'] ) ) { foreach (

Re: [PHP] Nested foreach ?

2004-10-17 Thread Stuart Felenstein
Robby Here is the printout : Using- print_r ($skills); print_r ($skys); print_r ($slus); Array ( [0] = skillone [1] = skilltwo [2] = skillthree [3] = [4] = ) Array ( [0] = 2 [1] = 3 [2] = 4 [3] = [4] = ) Array ( [0] = [1] = [2] = [3] = [4] = ) 1 FYI - The skills is a string, skys and slus

Re: [PHP] Nested foreach ?

2004-10-17 Thread Robby Russell
On Sun, 2004-10-17 at 12:40 -0700, Stuart Felenstein wrote: Robby Here is the printout : Using- print_r ($skills); print_r ($skys); print_r ($slus); Array ( [0] = skillone [1] = skilltwo [2] = skillthree [3] = [4] = ) Array ( [0] = 2 [1] = 3 [2] = 4 [3] = [4] = ) Array ( [0] = [1] =

Re: [PHP] Nested foreach ?

2004-10-17 Thread Stuart Felenstein
They are related in the sense that they are part of one record in the database. Fields Skill YearsUsed LastUsed When you say array of arrays you are referring to a multi-dimensional ? I'm not sure what you mean by are the [0] related. Thank you, Stuart --- Robby Russell [EMAIL PROTECTED]

Re: [PHP] Nested foreach ?

2004-10-17 Thread Robby Russell
On Sun, 2004-10-17 at 13:08 -0700, Stuart Felenstein wrote: They are related in the sense that they are part of one record in the database. Fields Skill YearsUsed LastUsed When you say array of arrays you are referring to a multi-dimensional ? I'm not sure what you mean by are the

Re: [PHP] Nested foreach ?

2004-10-17 Thread Stuart Felenstein
Okay, I will try - I have these three fields in a form for user input. There are 10 sets of these, i.e. Users can enter three sets of skills, with the yearsused and when last used. I have set them up as arrays, since it's probably not wise to manage 30 seperate variables. I'm using session

Re: [PHP] Nested foreach ?

2004-10-17 Thread John Holmes
Stuart Felenstein wrote: Here is the printout : Using- print_r ($skills); print_r ($skys); print_r ($slus); Array ( [0] = skillone [1] = skilltwo [2] = skillthree [3] = [4] = ) Array ( [0] = 2 [1] = 3 [2] = 4 [3] = [4] = ) Array ( [0] = [1] = [2] = [3] = [4] = ) 1 FYI - The skills is a string,

Re: [PHP] Nested foreach ?

2004-10-17 Thread Stuart Felenstein
John, Sorry, I'm not trying to be unclear. There are 3 columns in the table. In the user form. there are 30 fields, 10 text and 20 dropdown. The 10 text are: $_SESSION['skills'] = $_POST['skill']; The first dropdown is : $_SESSION['skys'] = $_POST['sky']; The second dropdown is:

Re: [PHP] Nested foreach ?

2004-10-17 Thread Chris Dowell
][name] /select name=skills[1][years] /select name=skills[1][used] / input type=text name=skills[2][name] /select name=skills[2][years] /select name=skills[2][used] / ... input type=text name=skills[9][name] /select name=skills[9][years] /select name=skills[9][used] / Then in PHP ?php foreach

Re: [PHP] Nested foreach ?

2004-10-17 Thread John Holmes
Stuart Felenstein wrote: John, Sorry, I'm not trying to be unclear. There are 3 columns in the table. In the user form. there are 30 fields, 10 text and 20 dropdown. The 10 text are: $_SESSION['skills'] = $_POST['skill']; The first dropdown is : $_SESSION['skys'] = $_POST['sky']; The second

[PHP] Nested foreach ?

2004-10-17 Thread Stuart Felenstein
I have 3 arrays. 3 for 3 fields in a table (all part of 1 record) array1 - field1 array2 - field2 array3 - field3 What I've been doing which works good with one array: if ( is_array( $_SESSION['foo'] ) ) { foreach ( $_SESSION['foo'] as $x ) { sql .= INSERT INTO TABLE (...

[PHP] using foreach() to capture multiple selections

2004-09-21 Thread Luke Mackenzie
Subject: using foreach() to capture multiple selections hi, i would like to to put multiple selections from a form list into a single variable using foreach but am unsure how to do so. can someone advise how to adapt the following code? ?php print You are interested in: ; foreach($myGoals as

Re: [PHP] using foreach() to capture multiple selections

2004-09-21 Thread Greg Donald
On Tue, 21 Sep 2004 20:26:04 +0100, Luke Mackenzie [EMAIL PROTECTED] wrote: i would like to to put multiple selections from a form list into a single variable using foreach but am unsure how to do so. can someone advise how to adapt the following code? ?php print You are interested in: ;

Re: [PHP] using foreach() to capture multiple selections

2004-09-21 Thread John Holmes
From: Luke Mackenzie [EMAIL PROTECTED] i would like to to put multiple selections from a form list into a single variable using foreach but am unsure how to do so. can someone advise how to adapt the following code? print You are interested in: ; foreach($myGoals as $value) { print $value ; } $var

Re: [PHP] using foreach() to capture multiple selections

2004-09-21 Thread Matthew Sims
the work for you but do you mean: You are interested in: form method=post action=phpPage.php ?php foreach ($myGoals as $value): ? input type=radio name=goals value=?php echo $value; ??php echo $value; ? ?php endforeach; ? /form -- --Matthew Sims --http://killermookie.org -- PHP General

Re: [PHP] using foreach() to capture multiple selections

2004-09-21 Thread Jason Wong
On Wednesday 22 September 2004 03:26, Luke Mackenzie wrote: Subject: using foreach() to capture multiple selections i would like to to put multiple selections from a form list into a single variable using foreach but am unsure how to do so. manual PHP and HTML -- Jason Wong - Gremlins

Re: [PHP] using foreach() to capture multiple selections

2004-09-21 Thread Janet Valade
Luke Mackenzie wrote: Subject: using foreach() to capture multiple selections hi, i would like to to put multiple selections from a form list into a single variable using foreach but am unsure how to do so. can someone advise how to adapt the following code? ?php print You are interested in: ;

Re: [PHP] Re: foreach()

2004-09-10 Thread Wouter van Vliet
On Wed, 08 Sep 2004 16:41:38 +0200, Daniel Kullik [EMAIL PROTECTED] wrote: Anthony Ritter wrote: I get a: Warning: Invalid argument supplied for foreach() in c:\apache\htdocs\or_6.4.php on line 15 after submitting the form. Hello Anthony! As long as you don't submit the form

[PHP] Re: foreach()

2004-09-08 Thread Daniel Kullik
Anthony Ritter wrote: I get a: Warning: Invalid argument supplied for foreach() in c:\apache\htdocs\or_6.4.php on line 15 after submitting the form. Hello Anthony! As long as you don't submit the form with a single option selected there will be no $_POST['lunch'], therefore foreach() won't be

[PHP] Re: Foreach Array Help

2003-10-14 Thread Rob Adams
Jed R. Brubaker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Okay, total newbie when it comes to arrays, and I could really use some help. I sure this will be an easy one for you veterans out there. Here is the array ($code): array(2) { [total]= int(1) [assign]=

[PHP] Re: Foreach Array Help

2003-10-14 Thread Jed R. Brubaker
First of all, thanks for the response. Here is where I am getting lost: In $code['assign'][1] - 1 is the assignment ID, and I would like the array to be able to hold a billion of these different assignments all with conceivably a billion codeapply ID as in $code['assign'][1]['codeapply'][3],

[PHP] Re: Foreach Array Help

2003-10-14 Thread Jed R. Brubaker
Never mind - I figured it out. While I was traversing like this: foreach ($this-code['assign'] as $assign = $details) { foreach ($assign['codeapply'] as $codeapply = $ca_details) { } } I had set up $assign to be the key value, and

[PHP] Re: Foreach Array Help

2003-10-14 Thread Rob Adams
Jed R. Brubaker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] First of all, thanks for the response. Here is where I am getting lost: In $code['assign'][1] - 1 is the assignment ID, and I would like the array to be able to hold a billion of these different assignments all with

[PHP] Re: Foreach POST VARS problem

2003-08-15 Thread Catalin Trifu
hi, Are you sure the data is posted from HTML through POST ? try adding the lines below: $colors=; if(is_array($HTTP_POST_VARS) !empty($HTTP_POST_VARS )) { foreach($HTTP_POST_VARS as $ThisVar=$ThisVal){ if(ereg(color-, $ThisVar) AND $ThisVal==on OR $ThisVal==1){

[PHP] Re: Foreach POST VARS problem

2003-08-15 Thread Catalin Trifu
btw! if you use it inside a function, you need to declare it as global! Catalin Are you sure the data is posted from HTML through POST ? try adding the lines below: $colors=; if(is_array($HTTP_POST_VARS) !empty($HTTP_POST_VARS )) { foreach($HTTP_POST_VARS as

[PHP] strange foreach behaviour

2003-08-05 Thread Martin Peck
I have come up against a very strange problem. I currently have no idea how to even approach attempting to fix it... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] multiple foreach

2003-03-20 Thread Richard Whitney
Maybe someone can see what I'm trying to do with this: foreach($charge as $c){ foreach($size_id as $s){$sql = UPDATE products_to_sizes SET surcharge = '$c' WHERE product_id = '$products_id' AND size_id = '$s'; mysql_query($sql) or die (Couldn't update rows.MYSQL_ERROR()); print $sql.'br';} } I

RE: [PHP] multiple foreach

2003-03-20 Thread Martin Towell
'; } -Original Message- From: Richard Whitney [mailto:[EMAIL PROTECTED] Sent: Friday, March 21, 2003 1:00 PM To: [EMAIL PROTECTED] Subject: [PHP] multiple foreach Maybe someone can see what I'm trying to do with this: foreach($charge as $c){ foreach($size_id as $s){$sql = UPDATE products_to_sizes SET

RE: [PHP] multiple foreach

2003-03-20 Thread Richard Whitney
] ### Sent: Friday, March 21, 2003 1:00 PM ### To: [EMAIL PROTECTED] ### Subject: [PHP] multiple foreach ### ### ### Maybe someone can see what I'm trying to do with this: ### ### foreach($charge as $c){ ### ### foreach($size_id as $s){$sql = UPDATE products_to_sizes SET surcharge = ### '$c' ### WHERE

[PHP] Re: Foreach ...... Help

2002-11-06 Thread Remon Redika
Parse error: parse error, unexpected '=' in /home/intra/Inventroot/software/savedata.php on line 35 ?php $vary(100); $i = 0; foreach($InputY as $y){ $vary($i) = $y; -line 35 $i++; } foreach($Nama_Software as $x){ $insertq = Insert into NSoftware (X, Y) values

Re: [PHP] Re: Foreach ...... Help

2002-11-06 Thread Rasmus Lerdorf
Your code is bogus. You probably want: $vary[$i] = $y; And $vary(100) also makes no sense. Also, why are you looping through the $InputY array and putting all the values into $vary? Why not just do $vary = $InputY; ? If it is because you need to renumber the indices, have a look at the

[PHP] Re: Foreach ...... Help

2002-11-06 Thread Remon Redika
Sorry before. I Just to try to Explain my Problem may be this my reason .. I have Two Text Fields The First Text Field i call it InputX input type='text' name='InputX' size='50' and The Second Text Field I Call it InputY, Generatable Field (using javascripts), if User Click the Button

[PHP] Re: foreach, side effect or good behaviour?

2002-09-23 Thread Stephan Seidt
It's good behavoiur because everytime even a reference gets a value, also the target which it is pointing on should get the same value. On Mon, 23 Sep 2002 12:57:56 +0200 (CEST), [EMAIL PROTECTED] (Jean-Pierre arneodo) wrote: Hi, $a=1; $b=$a; foreach(array(2,3) as $b); echo a=$a; //

[PHP] Re: foreach fails on unitialized array?

2002-08-30 Thread Richard Lynch
When I use foreach on a uninitialized array I get the following warning: Warning: Invalid argument supplied for foreach() in /www/htdocs/jc/cart/add_item.php on line 21 I would expect foreach to treat an unitialized variable as an empty array and hence do nothing. Is this the expected

[PHP] Re: foreach fails on unitialized array?

2002-08-30 Thread Richard Lynch
From: "Richard Lynch" [EMAIL PROTECTED] If you absolute *MUST* refuse to initialize the array (BAD IDEA!) You would be *MUCH* better off listening to those warnings and fixing your code. I totally agree with. I was just peeved that PHP would handle unitiliazed strings without a warning (a

[PHP] Usiing FOREACH to loop through Array

2002-06-29 Thread Brad Melendy
Hi All, I've stumped myself here. In a nutshell, I have a function that returns my array based on a SQL query and here's the code: -begin code--- function getCourses($UID) { global $link; $result = mysql_query( SELECT C.CourseName FROM tblcourses C, tblusers U,

Re: [PHP] Usiing FOREACH to loop through Array

2002-06-29 Thread Steve Edberg
At 3:27 PM -0700 6/29/02, Brad Melendy wrote: Hi All, I've stumped myself here. In a nutshell, I have a function that returns my array based on a SQL query and here's the code: -begin code--- function getCourses($UID) { global $link; $result = mysql_query(

Re: [PHP] Usiing FOREACH to loop through Array

2002-06-29 Thread Steve Edberg
Oops! It's hot, it's Saturday, brain not functioning at 100%, made cut'n'paste error: SNIP or (2) set a flag in getCourses() so that the query is only executed once, otherwise returning a result line - something like: function getCourses($UID) global $link; static $result =

Re: [PHP] Usiing FOREACH to loop through Array

2002-06-29 Thread Brad Melendy
Steve, Thanks very much. This make total sense to me. Now, I was pretty sure that I was getting an array back from mysql_fetch_array because when I do a 'print $myCourses' without specifying any value, I just get 'array' which I believe I am supposed to, IF it is truly an array. Anyway, I'm

Re: [PHP] Usiing FOREACH to loop through Array

2002-06-29 Thread Steve Edberg
At 7:35 PM -0700 6/29/02, Brad Melendy wrote: Steve, Thanks very much. You're welcome! This make total sense to me. Now, I was pretty sure that I was getting an array back from mysql_fetch_array because when I do a 'print $myCourses' without specifying any value, I just get 'array' which I

Re: [PHP] Usiing FOREACH to loop through Array

2002-06-29 Thread Brad Melendy
Steve, Thanks a ton! I'm now running slick as a whistle using your option #1 (looping through the results in the function) and using the newer mysql_fetch_assoc() function. I have a much better understanding of this now and I really appreciate your help. Hopefully I'll get a chance to help

[PHP] if foreach

2002-05-29 Thread Laurent Drouet
Hi ! I would like to know if somebody already done the following thing : I'm writing a function which accept 2 args : $conditions and $summary in my function I have to construct an if statement with these arg like : if foreach ($conditions as $key=$val) ($val==$summary[$key])

Re: [PHP] if foreach

2002-05-29 Thread Nick Wilson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * and then Laurent Drouet declared if foreach ($conditions as $key=$val) ($val==$summary[$key]) { statements to execute if the condition is right for all $conditions } How

Re: [PHP] weird foreach problem when calling date or getdate function,variable does not change

2002-05-05 Thread Miguel Cruz
On Sat, 4 May 2002, Zachary Buckholz wrote: $time = getdate($array[0]); print $time[hours]:$time[minutes]:$time[seconds] = $chk_status = $resp_sec 20020504160503 -- Notice how this date/time value is updated properly each loop 20:14:7 = 200 = 2 -- Notice how

Re: [PHP] weird foreach problem when calling date or getdate function,

2002-05-05 Thread Kyle Gibson
Those numbers don't look like timestamps to me (as they can't be larger than about 4294967296). What they look like is the result of some imp or perhaps even a gremlin breaking into your code and smooshing together yearmonthdayhourminutesecond, then trying to PRETEND it's a timestamp.

Re: [PHP] weird foreach problem when calling date or getdate function,

2002-05-05 Thread Miguel Cruz
On Sun, 5 May 2002, Kyle Gibson wrote: Those numbers don't look like timestamps to me (as they can't be larger than about 4294967296). What they look like is the result of some imp or perhaps even a gremlin breaking into your code and smooshing together yearmonthdayhourminutesecond, then

[PHP] Re: foreach not in reach

2002-02-22 Thread David Robley
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... Question 1: How can I append strings to my authors array? Me thinks this doesn't work :§) ? $authors .= explode(;, $mydata-KW); I'm getting Invalid argument supplied for foreach() Question 2: Once I get this working, I want to (a)

[PHP] Re: foreach array into mail isn´t working

2002-01-21 Thread Ken Gregg
Blank lines are important to the parsing of mail messages. File does not strip newlines. Try your code and strip the newlines off the email addresses. If you still have problems try it and drop the newlines from the subject. Ken Gregg Enhanced Data Systems, Inc. http://www.rwre.com for the

[PHP] Re: Foreach loop syntax

2001-08-14 Thread Richard Lynch
Ok, I asked a similar question more than a year ago, so I apologize for being a little redundant :) Why was PHP's foreach loop syntax chosen to be foreach($dogs as $dog){} instead of something more common (Python, Javascript, can't think what else right now) and, to me, more intuitive,

[PHP] RE: foreach and multiple arrays

2001-07-30 Thread Tim Ward
Why can't you create the arrays as associative arrays in the first place $fred[] = array(title=Apple,value=Red,size1=10,size2=20); $fred[] = array(title=Banana,value=Yellow,size1=10,size2=20); then foreach($fred as $thisfred) foreach ($thisfred as

Re: [PHP] Nesting 'foreach ()'

2001-03-03 Thread Daniel Grace
"Tim Ward" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... is okay (but still doesn't work) although I have noticed that you seem to need to code-block single statements in if ... else constructs i.e if (1==1) echo("fred") else echo("bill"): should work but

RE: [PHP] Nesting 'foreach ()'

2001-01-30 Thread Tim Ward
.html -Original Message- From: Chris Fry [mailto:[EMAIL PROTECTED]] Sent: 30 January 2001 03:56 To: Tim Ward Cc: PHP News Group (E-mail) Subject: Re: [PHP] Nesting 'foreach ()' Tim, Works fine in 4.04pl1 on NT. I think you should have curly braces round the inner foreach as well

[PHP] Nesting 'foreach ()'

2001-01-29 Thread Tim Ward
according to the online refernce foreach() doesn't change the array pointer. However the following code: $fred = array(1,2,3,4,5,6); foreach ($fred as $fred1) { foreach ($fred as $fred2) echo "$fred1 : $fred2br"; }; returns: 1 : 1 1 : 2 1 : 3 1 : 4 1 : 5 1 : 6 and stops

Re: [PHP] Nesting 'foreach ()'

2001-01-29 Thread Chris Fry
Tim, Works fine in 4.04pl1 on NT. I think you should have curly braces round the inner foreach as well? $fred = array(1,2,3,4,5,6); foreach ($fred as $fred1) { foreach ($fred as $fred2) { echo "$fred1 : $fred2br"; } }; Chris Fry Tim Ward wrote: according

Re: [PHP] Nesting 'foreach ()'

2001-01-29 Thread Philip Olson
Perhaps : http://php.net/ChangeLog-4.php Under 4.0.2 it says : "Fixed problem with nested foreach()'s. (Andi, Zend Engine)" philip On Tue, 30 Jan 2001, Chris Fry wrote: Tim, Works fine in 4.04pl1 on NT. I think you should have curly braces round the inner foreach as well? $fred =

<    1   2