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
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 (
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
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] =
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]
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
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
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,
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:
][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
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
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 (...
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
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: ;
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
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
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
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: ;
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
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
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]=
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],
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
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
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){
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
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
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
';
}
-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
]
### 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
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
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
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
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;
//
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
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
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,
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(
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 =
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
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
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
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])
-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
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
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.
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
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)
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
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,
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
"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
.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
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
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
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 =
101 - 156 of 156 matches
Mail list logo