RE: [PHP] Array help.

2012-10-24 Thread Ford, Mike
> From: Paul Halliday [paul.halli...@gmail.com] > Sent: 24 October 2012 18:38 > To: PHP-General > Subject: [PHP] Array help. > > $groupMappings = array('40' =>'A','41' =>'B','1' =>'C'); > >

Re: [PHP] Array help.

2012-10-24 Thread Paul Halliday
aul.halli...@gmail.com] > Enviada em: quarta-feira, 24 de outubro de 2012 15:38 > Para: PHP-General > Assunto: [PHP] Array help. > > I am processing v4IP's and what I want to do is a prefix substitution if the > 3rd octet matches a predefined list $groupMappings. I went down thi

RES: [PHP] Array help.

2012-10-24 Thread Samuel Lopes Grigolato
Could you try changing this: if($groupTest != FALSE) { to this: if($groupTest !== FALSE) { ? -Mensagem original- De: Paul Halliday [mailto:paul.halli...@gmail.com] Enviada em: quarta-feira, 24 de outubro de 2012 15:38 Para: PHP-General Assunto: [PHP] Array help. I am processing

Re: [PHP] Array & unset()

2012-09-24 Thread Ashley Sheridan
Ken Robinson wrote: >At 08:50 PM 9/23/2012, Ron Piggott wrote: > >>I am wondering if there is a way to remove from >>an array where the value is 0 (“zero”) >> >>Array example: >> >>$total_points_awarded = array( 1 => 17, 3 => 14, 4 => 0, 5 => 1, 6 => >0 ); >> >>In this example I would like

Re: [PHP] Array & unset()

2012-09-23 Thread Ken Robinson
At 08:50 PM 9/23/2012, Ron Piggott wrote: I am wondering if there is a way to remove from an array where the value is 0 (“zero”) Array example: $total_points_awarded = array( 1 => 17, 3 => 14, 4 => 0, 5 => 1, 6 => 0 ); In this example I would like to remove element # 4 and # 6. The “

[PHP] Array & unset()

2012-09-23 Thread Ron Piggott
I am wondering if there is a way to remove from an array where the value is 0 (“zero”) Array example: $total_points_awarded = array( 1 => 17, 3 => 14, 4 => 0, 5 => 1, 6 => 0 ); In this example I would like to remove element # 4 and # 6. The “key” ( 1,3,4,5,6 ) represents the member’s accou

Re: [PHP] PHP array unions

2012-09-14 Thread Adam Richardson
On Fri, Sep 14, 2012 at 2:30 AM, Matijn Woudt wrote: > > It doesn't need to be clunky.. just use array_flip and you've got the old > array again.. > Well, array_flip has it's own potential issues (duplicate values are lost, so my example of using zeros would not work.) I suppose I could duplicate

Re: [PHP] PHP array unions

2012-09-13 Thread Matijn Woudt
Op 14 sep. 2012 07:51 schreef "Adam Richardson" het volgende: > > On Wed, Sep 12, 2012 at 2:37 PM, Sebastian Krebs wrote: > > Hi, > > > > In PHP the array is in fact a hash map, but especially it is _used_ for > > nearly everything map-, set-, ...-like thing. So in short: The is no > > operator o

Re: [PHP] PHP array unions

2012-09-13 Thread Adam Richardson
On Wed, Sep 12, 2012 at 2:37 PM, Sebastian Krebs wrote: > Hi, > > In PHP the array is in fact a hash map, but especially it is _used_ for > nearly everything map-, set-, ...-like thing. So in short: The is no > operator or built-in function, that merges two arrays _and_ treat them as > set (instea

Re: [PHP] PHP array unions

2012-09-12 Thread Sebastian Krebs
Hi, In PHP the array is in fact a hash map, but especially it is _used_ for nearly everything map-, set-, ...-like thing. So in short: The is no operator or built-in function, that merges two arrays _and_ treat them as set (instead of the hashmap, what they are). Your solution is the way to g

Re: [PHP] array

2011-12-31 Thread Govinda
>> how can you explain someone in a simplest and everyday use example of ARRAY. > > The manual page explains it pretty succinctly. I don't think you'll get > more simple than this, as there is obvious prerequisite knowledge > assumed (i.e. that you know what a simple variable is, etc) Hi saeed,

Re: [PHP] array

2011-12-31 Thread Ashley Sheridan
On Sat, 2011-12-31 at 14:53 +0100, saeed ahmed wrote: > how can you explain someone in a simplest and everyday use example of ARRAY. > The manual page explains it pretty succinctly. I don't think you'll get more simple than this, as there is obvious prerequisite knowledge assumed (i.e. that you

[PHP] array

2011-12-31 Thread saeed ahmed
how can you explain someone in a simplest and everyday use example of ARRAY. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Novice: PHP array by reference question (by C++ programmer)

2011-10-31 Thread Louis Huppenbauer
-- Forwarded message -- From: Louis Huppenbauer Date: 2011/10/31 Subject: Re: [PHP] Novice: PHP array by reference question (by C++ programmer) To: Manish Gupta You have to assign the value by reference too public function __construct(& $bar) { $this->_bar

[PHP] Novice: PHP array by reference question (by C++ programmer)

2011-10-31 Thread Manish Gupta
I have a class that takes as input, an array by reference and stores it in a member variable. A method in this class later modifies the member variable (which contains reference to the array). When I access the local variable that was passed by reference to the constructor of this class object, I

[PHP] Novice: PHP array by reference question (by C++ programmer)

2011-10-31 Thread Manish Gupta
I have a class that takes as input, an array by reference and stores it in a member variable. A method in this class later modifies the member variable (which contains reference to the array). When I access the local variable that was passed by reference to the constructor of this class object,

Re: [PHP] Array has `trailing comma`, why not the same for function parameter list?

2011-10-31 Thread Daniel Brown
On Sun, Oct 30, 2011 at 08:47, Nam Gi VU wrote: > It is convenient to have a trailing comma when defining an array - so as > easy to add/remove code to add/remove an entry to the array > > array( >    'key00' => 'value00', >    'key01' => 'value01', >    'key02' => 'value02', >    ... > ) > > I su

Re: [PHP] Array has `trailing comma`, why not the same for function parameter list?

2011-10-30 Thread Jeremiah Dodds
On Sun, Oct 30, 2011 at 8:47 AM, Nam Gi VU wrote: > It is convenient to have a trailing comma when defining an array - so as > easy to add/remove code to add/remove an entry to the array > > array( >    'key00' => 'value00', >    'key01' => 'value01', >    'key02' => 'value02', >    ... > ) > > I

[PHP] Array has `trailing comma`, why not the same for function parameter list?

2011-10-30 Thread Nam Gi VU
It is convenient to have a trailing comma when defining an array - so as easy to add/remove code to add/remove an entry to the array array( 'key00' => 'value00', 'key01' => 'value01', 'key02' => 'value02', ... ) I suggest to PHP Development team to make it available in the syntax

Re: [PHP] array problem

2011-09-09 Thread Ashley Sheridan
You are echoing out an array. If you use something like print_r() or var_dump() you will see the array elements Thanks, Ash http://www.ashleysheridan.co.uk -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. Marc Fromm wrote: I am reading a csv file into an array. The csv fil

Re: [PHP] array problem

2011-09-09 Thread Adam Balogh
hi, try to use print_r or var_dump to echo compound data type

Re: [PHP] array problem

2011-09-09 Thread Steve Staples
On Fri, 2011-09-09 at 16:00 +, Marc Fromm wrote: > I am reading a csv file into an array. The csv file. > > users.csv file contents: > w12345678,a > w23456789,b > w34567890,c > > $csvfilename = "users.csv"; > $handle = fopen($csvfilename, "r"); >

Re: [PHP] array problem

2011-09-09 Thread Joshua Stoutenburg
The function fgetcsv() returns an array. http://php.net/manual/en/function.fgetcsv.php On Fri, Sep 9, 2011 at 9:00 AM, Marc Fromm wrote: > I am reading a csv file into an array. The csv file. > > users.csv file contents: > w12345678,a > w23456789,b > w34567890,c > >

[PHP] array problem

2011-09-09 Thread Marc Fromm
I am reading a csv file into an array. The csv file. users.csv file contents: w12345678,a w23456789,b w34567890,c $csvfilename = "users.csv"; $handle = fopen($csvfilename, "r"); if($handle) {

[PHP] Array Search

2011-03-25 Thread Ethan Rosenberg
Dear List - Here is a code snippet: $bla = array("g1" => $results[7][6], "h1" => $results[7][7]); print_r($bla); $value = "h1"; $locate1 = array_search($value, $bla); echo "This is locate" ; print_r($locate1); if(in_array($value, $bla)) print_r($b

[PHP] Array of Error Codes: Key/Values

2011-03-16 Thread Brendan_Crowley
Hi, I'm new to php and i'm looking to setup an array (or what work best) of codes and corresponding error strings, for example (pseudo code): ERROR_CODES = array('-1' => 'Error opening file', '-2' => 'General File IO Error', '-3' => 'Database connection error'); Access these string values using

Re: [PHP] Array from one form to other?

2011-02-20 Thread Tamara Temple
On Feb 20, 2011, at 10:51 AM, Yogesh wrote: I don't entirely understand this; Dan Brown gave you solution to use curl to pass the array to the second "form" (do you mean script here?). That would certainly work, but I'm wondering if it wouldn't be more secure to spool out the array to a fi

Re: [PHP] Array from one form to other?

2011-02-20 Thread Yogesh
Hi Tamara, I don't entirely understand this; Dan Brown gave you solution to use curl to >> pass the array to the second "form" (do you mean script here?). That would >> certainly work, but I'm wondering if it wouldn't be more secure to spool out >> the array to a file from the first script after

Re: [PHP] Array from one form to other?

2011-02-20 Thread Tamara Temple
On Feb 19, 2011, at 6:38 PM, Yogesh wrote: I have two forms. One form helps read an input file into an array. And the other form needs this array as an input. I am able to read the input file into an array, but how do I pass it over to the other form. Both forms have PHP file as 'action'.

Re: [PHP] Array from one form to other?

2011-02-19 Thread Daniel Brown
On Sat, Feb 19, 2011 at 21:50, Yogesh wrote: > POST Use cURL, look into curl_setopt(), and add square brackets (and optional key names) to your array. A quick start: -- Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP General Mailing List (http:

Re: [PHP] Array from one form to other?

2011-02-19 Thread Yogesh
POST On Sat, Feb 19, 2011 at 9:44 PM, Daniel Brown wrote: > On Sat, Feb 19, 2011 at 19:38, Yogesh wrote: > > Hello, > > > > I have two forms. One form helps read an input file into an array. And > the > > other form needs this array as an input. > > I am able to read the input file into an

Re: [PHP] Array from one form to other?

2011-02-19 Thread Daniel Brown
On Sat, Feb 19, 2011 at 19:38, Yogesh wrote: > Hello, > > I have two forms. One form helps read an input file into an array. And the > other form needs this array as an input. > I am able to read the input file into an array, but how do I pass it over to > the other form. > > Both forms have PHP f

[PHP] Array from one form to other?

2011-02-19 Thread Yogesh
Hello, I have two forms. One form helps read an input file into an array. And the other form needs this array as an input. I am able to read the input file into an array, but how do I pass it over to the other form. Both forms have PHP file as 'action'. Please help. Thanks - Yogesh

Re: [PHP] array to var - with different name

2011-01-21 Thread Donovan Brooke
Donovan Brooke wrote: [snip] if ($t_ok) { } Small correction.. with my established naming convention.. the above ideally would be: > if ($b_ok) { > > } D -- D Brooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] array to var - with different name

2011-01-21 Thread Donovan Brooke
Paul M Foster wrote: [snip] Shawn, I don't know if I have a good reason, other than I rather like working with string vars instead of array vars from $_REQUEST for (sticky forms and conditionals). I can check/verify them as well in the process. You should probably get used to dealing with the a

Re: [PHP] array to var - with different name

2011-01-20 Thread Paul M Foster
On Thu, Jan 20, 2011 at 05:29:01PM -0600, Donovan Brooke wrote: [snip] > > > Shawn, I don't know if I have a good reason, other than I rather like > working with string vars instead of array vars from $_REQUEST for > (sticky forms and conditionals). I can check/verify them as well in the > pro

RE: [PHP] array to var - with different name

2011-01-20 Thread Tommy Pham
> -Original Message- > From: Donovan Brooke [mailto:li...@euca.us] > Sent: Thursday, January 20, 2011 3:29 PM > Cc: php-general@lists.php.net > Subject: Re: [PHP] array to var - with different name > > Tommy Pham wrote: > [snip] > >> foreach ($_REQUEST a

Re: [PHP] array to var - with different name

2011-01-20 Thread Donovan Brooke
Tommy Pham wrote: [snip] foreach ($_REQUEST as $key => $value) $$key = $value; short-circuited one-liners :) Regards, Tommy akk... wrong clicked before I had a chance to fix the code. anyway, foreach ($_GET as $key => $value) if (substr($key, 0, 2) == 'f_') ${'t_'.substr($key, 2)} = $valu

Re: [PHP] array to var - with different name

2011-01-20 Thread Tommy Pham
On Thu, Jan 20, 2011 at 3:09 PM, Tommy Pham wrote: > On Thu, Jan 20, 2011 at 2:28 PM, Donovan Brooke wrote: >> Hello again! >> >> I'm trying to find a good way to convert array key/value's to >> variable name values... but with the caveat of the name being >> slightly different than the original k

Re: [PHP] array to var - with different name

2011-01-20 Thread Tommy Pham
On Thu, Jan 20, 2011 at 2:28 PM, Donovan Brooke wrote: > Hello again! > > I'm trying to find a good way to convert array key/value's to > variable name values... but with the caveat of the name being > slightly different than the original key > (to fit my naming conventions). > > first, I (tediousl

Re: [PHP] array to var - with different name

2011-01-20 Thread Daniel Molina Wegener
On Thursday 20 January 2011, Donovan Brooke wrote: > Hello again! > > I'm trying to find a good way to convert array key/value's to > variable name values... but with the caveat of the name being > slightly different than the original key > (to fit my naming conventions). > > first, I (tediousl

[PHP] array to var - with different name

2011-01-20 Thread Donovan Brooke
Hello again! I'm trying to find a good way to convert array key/value's to variable name values... but with the caveat of the name being slightly different than the original key (to fit my naming conventions). first, I (tediously) did this: --- if (isset($_GET['f_action'])) { $t_action =

Re: [PHP] Array Symbol Suggestion

2011-01-13 Thread David Harkness
On Thu, Jan 13, 2011 at 10:07 AM, David Hutto wrote: > On Thu, Jan 13, 2011 at 12:59 PM, David Harkness > > I learned it early on as well, and I never really liked it. Instead of > > $iFish I would prefer a more descriptive name such as $fishCount. > > What info did you get on hook for the client

Re: [PHP] Array Symbol Suggestion

2011-01-13 Thread David Hutto
On Thu, Jan 13, 2011 at 12:59 PM, David Harkness wrote: > On Thu, Jan 13, 2011 at 2:23 AM, Richard Quadling wrote: > >> The Hungarian Notation [1] was what I was taught all those years ago >> when I learnt standard C programming. > > > I learned it early on as well, and I never really liked it. In

Re: [PHP] Array Symbol Suggestion

2011-01-13 Thread David Harkness
On Thu, Jan 13, 2011 at 2:23 AM, Richard Quadling wrote: > The Hungarian Notation [1] was what I was taught all those years ago > when I learnt standard C programming. I learned it early on as well, and I never really liked it. Instead of $iFish I would prefer a more descriptive name such as $fi

Re: [PHP] Array Symbol Suggestion

2011-01-13 Thread Richard Quadling
On 12 January 2011 20:23, wrote: > Thanks for all the responses to my suggestion.  I realize this would be a > major change, so that's why I also mentioned it as an addition to the > language. > > I'm sure it's just what you're used to, but still being new to all this, it > just makes sense (t

Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Per Jessen
Donovan Brooke wrote: > however, from my experience, there is often this kind of problem in > any language, and that is where naming conventions come in very handy. > > I don't know if the PHP community has any standard convention.. One popular naming convention: http://en.wikipedia.org/wiki/H

Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Per Jessen
Ashley Sheridan wrote: > On Wed, 2011-01-12 at 12:23 -0800, sono...@fannullone.us wrote: > >> Thanks for all the responses to my suggestion. I realize this would >> be a major change, so that's why I also mentioned it as an addition >> to the language. >> >> I'm sure it's just what you're used

Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Daniel Brown
On Wed, Jan 12, 2011 at 15:41, Michael Shadle wrote: > On Wed, Jan 12, 2011 at 12:37 PM, Daniel Brown wrote: > >>    The @ is an error control operator, used to buffer the output and >> store it in a variable - $php_errormsg.  There's no way that would be >> changed to become an array designator

Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Michael Shadle
On Wed, Jan 12, 2011 at 12:37 PM, Daniel Brown wrote: >    The @ is an error control operator, used to buffer the output and > store it in a variable - $php_errormsg.  There's no way that would be > changed to become an array designator (though that doesn't mean your > idea itself is a bad one).

Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Daniel Brown
On Wed, Jan 12, 2011 at 14:45, wrote: > I'd like to make a suggestion for a change, or possibly an addition, to the > PHP language. > > I'm learning PHP and have been very excited with what it can do in relation > to HTML.  But when I got to the part about arrays, I was disappointed to see > t

Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Joshua Kehn
On Jan 12, 2011, at 3:28 PM, Ashley Sheridan wrote: > If you check out the manual pages for those functions as well, you'll > see other related functions. I must say, of any language I've used, the > php.net documentation is by far the best, giving plenty of information > and user comments too. It

Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Joshua Kehn
On Jan 12, 2011, at 3:23 PM, sono...@fannullone.us wrote: > Thanks for all the responses to my suggestion. I realize this would be a > major change, so that's why I also mentioned it as an addition to the > language. > > I'm sure it's just what you're used to, but still being new to all this,

Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Ashley Sheridan
On Wed, 2011-01-12 at 12:23 -0800, sono...@fannullone.us wrote: > Thanks for all the responses to my suggestion. I realize this would be a > major change, so that's why I also mentioned it as an addition to the > language. > > I'm sure it's just what you're used to, but still being new to all

Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread sono-io
Thanks for all the responses to my suggestion. I realize this would be a major change, so that's why I also mentioned it as an addition to the language. I'm sure it's just what you're used to, but still being new to all this, it just makes sense (to me anyway) to have different symbols for diff

Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Steve Staples
On Wed, 2011-01-12 at 20:58 +0100, Per Jessen wrote: > sono...@fannullone.us wrote: > > > I'd like to make a suggestion for a change, or possibly an addition, > > to the PHP language. > > > > I'm learning PHP and have been very excited with what it can do in > > relation to HTML. But when I got

Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Ashley Sheridan
On Wed, 2011-01-12 at 11:45 -0800, sono...@fannullone.us wrote: > I'd like to make a suggestion for a change, or possibly an addition, to the > PHP language. > > I'm learning PHP and have been very excited with what it can do in relation > to HTML. But when I got to the part about arrays, I wa

Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Donovan Brooke
sono...@fannullone.us wrote: I'd like to make a suggestion for a change, or possibly an addition, to the PHP language. I'm learning PHP and have been very excited with what it can do in relation to HTML. But when I got to the part about arrays, I was disappointed to see that they are designa

Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Per Jessen
sono...@fannullone.us wrote: > I'd like to make a suggestion for a change, or possibly an addition, > to the PHP language. > > I'm learning PHP and have been very excited with what it can do in > relation to HTML. But when I got to the part about arrays, I was > disappointed to see that they are

[PHP] Array Symbol Suggestion

2011-01-12 Thread sono-io
I'd like to make a suggestion for a change, or possibly an addition, to the PHP language. I'm learning PHP and have been very excited with what it can do in relation to HTML. But when I got to the part about arrays, I was disappointed to see that they are designated with a $ the same as other

Re: [PHP] array question

2010-12-20 Thread Ravi Gehlot
Jim Lucas has it. You can use the preg_match function to find it. I would use regexp for that reason. regexp is good for making sure things are typed the way they need to (mostly used for). Ravi. On Sat, Dec 18, 2010 at 5:17 PM, Jim Lucas wrote: > On 12/17/2010 12:52 PM, Sorin Buturugeanu wrot

Re: [PHP] array question

2010-12-18 Thread Jim Lucas
On 12/17/2010 12:52 PM, Sorin Buturugeanu wrote: Hello all! I have a question regarding arrays and the way I can use a value. Let's say I have this string: $s = 'banana,apple,mellon,grape,nut,orange' I want to explode it, and get the third value. For this I would normally do: $a = explode(',

Re: [PHP] array question

2010-12-17 Thread Sorin Buturugeanu
Tanks for all of your responses! I guess a function is the way to go. I just have to see if the situation comes up enough times to justify the function approach. @Dan: I really enjoyed your disclaimer :D -- Sorin Buturugeanu www.soin.ro

Re: [PHP] array question

2010-12-17 Thread Daniel Brown
On Fri, Dec 17, 2010 at 15:52, Sorin Buturugeanu wrote: > Hello all! > > I have a question regarding arrays and the way I can use a value. > > Let's say I have this string: > > $s = 'banana,apple,mellon,grape,nut,orange' > > I want to explode it, and get the third value. For this I would normally

RE: [PHP] array question

2010-12-17 Thread Jay Blanchard
[snip] I have a question regarding arrays and the way I can use a value. Let's say I have this string: $s = 'banana,apple,mellon,grape,nut,orange' I want to explode it, and get the third value. For this I would normally do: $a = explode(',', $s); echo $s[2]; That's all fine, but is there a way

[PHP] array question

2010-12-17 Thread Sorin Buturugeanu
Hello all! I have a question regarding arrays and the way I can use a value. Let's say I have this string: $s = 'banana,apple,mellon,grape,nut,orange' I want to explode it, and get the third value. For this I would normally do: $a = explode(',', $s); echo $s[2]; That's all fine, but is there

RE: [PHP] Array problem

2010-10-28 Thread Bob McConnell
From: Richard Quadling > On 27 October 2010 22:15, Kevin Kinsey wrote: >> Marc Guay wrote: As Nicholas pointed out, the extra underscore in the key is the issue. >>> >>> That's way too easy a fix.  I think he should check to make sure his >>> version of PHP was compiled with the right e

Re: [PHP] Array problem

2010-10-28 Thread Richard Quadling
On 27 October 2010 22:15, Kevin Kinsey wrote: > Marc Guay wrote: >>> >>> As Nicholas pointed out, the extra underscore in the key is the issue. >> >> That's way too easy a fix.  I think he should check to make sure his >> version of PHP was compiled with the right extensions and that the >> browse

Re: [PHP] Array problem

2010-10-27 Thread Kevin Kinsey
Marc Guay wrote: As Nicholas pointed out, the extra underscore in the key is the issue. That's way too easy a fix. I think he should check to make sure his version of PHP was compiled with the right extensions and that the browser isn't doing something unpredictably bizarre when submitting the

Re: [PHP] Array / form processing

2010-10-08 Thread Sebastian Detert
Ron Piggott schrieb: I am writing a custom shopping cart that eventually the "cart" will be uploaded to PayPal for payment. I need to be able to include the option that the purchase is a gift certificate. At present my "add to cart" function goes like this: === # Gift Certificate: 1 is a gif

Re: [PHP] Array / form processing

2010-10-07 Thread chris h
I don't know what the context is like, but you may be better off just using an entire form here with hidden fields. i.e. Without knowing what else is going on in your page, and how the request is being handled on the server, it's kind of hard to give exact advice. :) Chris H.

Re: [PHP] Array / form processing

2010-10-07 Thread Ron Piggott
Many thanks, Chris. I have one additional question about this shopping cart project. I need to make a submit button for the purpose of removing an item from the shopping cart. What I am struggling with is to find an effective method for passing the product serial number (auto_increment in the

Re: [PHP] Array / form processing

2010-10-07 Thread chris h
$_SESSION['life_coaching_order'][$product][$gift]['quantity'] = $_SESSION['life_coaching_order'][$product][$gift]['quantity'] + 1; === ... === foreach ($_SESSION['life_coaching_order'] AS $coaching_fee_theme_reference => $value ) { === In this example $value would be an array. To test if it is

[PHP] Array / form processing

2010-10-07 Thread Ron Piggott
I am writing a custom shopping cart that eventually the "cart" will be uploaded to PayPal for payment. I need to be able to include the option that the purchase is a gift certificate. At present my "add to cart" function goes like this: === # Gift Certificate: 1 is a gift; 2 is personal use

Re: [PHP] Array question

2010-09-26 Thread tedd
At 3:31 PM -0500 9/25/10, MikeB wrote: -snip- My question, in the loop, why does tha author use: $results[] = mysql_fetch_array($result); instead of (as I would expect): $results[$j] = mysql_fetch_array($result);? What PHP magic is at work here? Mike: That's just a shorthand way to popula

Re: [PHP] Array question

2010-09-26 Thread a...@ashleysheridan.co.uk
eater than the highest already in use. As the index 2 was explicitly created, php made the next one at 3. Thanks, Ash http://www.ashleysheridan.co.uk - Reply message - From: "chris h" Date: Sat, Sep 25, 2010 22:05 Subject: [PHP] Array question To: "MikeB" Cc: Mike,

Re: [PHP] Array question

2010-09-25 Thread chris h
Mike, $results[] will automatically push a value unto the end of an array. So doing this... -- $magic = array(); $magic[] = 'a'; $magic[] = 'b'; $magic[] = 'c'; - is exactly this same as doing this... -- $normal = array(); $normal[0] = 'a'; $normal[1] = 'b'; $normal[2] = 'c'; -

[PHP] Array question

2010-09-25 Thread MikeB
I have the following code: $query = "SELECT * FROM classics"; $result = mysql_query($query); if (!$result) die ("Database access failed: " . mysql_error()); $rows = mysql_num_rows($result); for ($j = 0 ; $j < $rows ; ++$j) { $results[] = mysql_fetch_array($result); } mysql_close($db_server

Re: [PHP] Array help.

2010-07-30 Thread Joshua Kehn
On Jul 30, 2010, at 3:03 PM, Paul Halliday wrote: >> >> Paul- >> >> Why are those values not defaulted to 0 in the database? >> >> Regards, >> >> -Josh >> >> > > They are defaulted, the query is grouping: > > select count(status) as count, status from table group by status

Re: [PHP] Array help.

2010-07-30 Thread Paul Halliday
On Fri, Jul 30, 2010 at 3:44 PM, Joshua Kehn wrote: > > On Jul 30, 2010, at 2:36 PM, Paul Halliday wrote: > >> I have a query that may not always return a result for a value, I need >> to reflect this with a "0". I am trying to overcome this by doing this >> (the keys are ID's): >> >> while ($row

Re: [PHP] Array help.

2010-07-30 Thread Joshua Kehn
On Jul 30, 2010, at 2:36 PM, Paul Halliday wrote: > I have a query that may not always return a result for a value, I need > to reflect this with a "0". I am trying to overcome this by doing this > (the keys are ID's): > > while ($row = mysql_fetch_row($statusQuery)) { > >$cat = > arra

[PHP] Array help.

2010-07-30 Thread Paul Halliday
I have a query that may not always return a result for a value, I need to reflect this with a "0". I am trying to overcome this by doing this (the keys are ID's): while ($row = mysql_fetch_row($statusQuery)) { $cat = array(0=>0,1=>0,11=>0,12=>0,13=>0,14=>0,15=>0,16=>0,17=>0,19=>0);

Re: [PHP] php array in different OS

2010-07-27 Thread jose javier parra sanchez
you are probably getting a memory limit error, check your php.ini 2010/7/21 fyang : > Dear all, > I have a simple test code in different OS ,but it give me a different > result. > the code as follows: > $n= 5; > for($i=0;$i<$n;$i++) > { >$data[]=array(""

[PHP] Re: php array in different OS

2010-07-23 Thread Yang Fei
Dear Colin Guthrie , Thanks for your help very much. According to your suggestion, I have solved the question. best wish, Yang Fei 2010-7-24

[PHP] Re: php array in different OS

2010-07-23 Thread Colin Guthrie
'Twas brillig, and fyang at 22/07/10 03:34 did gyre and gimble: Dear Bob McConnell, Thank you for your reply. I really post the same message eight times because of the first e-mail authentication.please remove the extra e-mail in your free time. There are two servers ,the

Re: [PHP] php array in different OS

2010-07-21 Thread fyang
em or need other configurations. Please give further guidance, thank you very much! best wishs, Yang Fei 2010-7-22 发件人: Bob McConnell 发送时间: 2010-07-21 20:06:36 收件人: fyang; php-general@lists.php.net 抄送: 主题: RE: [PHP] php array in different OS From: fyang > I have a sim

RE: [PHP] php array in different OS

2010-07-21 Thread Bob McConnell
From: fyang > I have a simple test code in different OS ,but it give me a different > result. > the code as follows: > $n= 5; > for($i=0;$i<$n;$i++) > { > $data[]=array("",$i,$i/1000); > echo $i," ",$data[$i][1],""; >

[PHP] php array in different OS

2010-07-20 Thread fyang
Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: "; } echo "count:",count($data); ?> OS1: Red Hat Enterprise Linux Server release 5.1 Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux test resu

[PHP] php array in different OS

2010-07-20 Thread Yang Fei
Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: "; } echo "count:",count($data); ?> OS1: Red Hat Enterprise Linux Server release 5.1 Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux t

[PHP] php array in different OS

2010-07-20 Thread fyang
Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: "; } echo "count:",count($data); ?> OS1: Red Hat Enterprise Linux Server release 5.1 Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux test resu

[PHP] php array in different OS

2010-07-20 Thread fyang
Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: "; } echo "count:",count($data); ?> OS1: Red Hat Enterprise Linux Server release 5.1 Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux test resu

[PHP] php array in different OS

2010-07-20 Thread fyang
Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: "; } echo "count:",count($data); ?> OS1: Red Hat Enterprise Linux Server release 5.1 Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux test resu

[PHP] php array in different OS

2010-07-20 Thread fyang
Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: "; } echo "count:",count($data); ?> OS1: Red Hat Enterprise Linux Server release 5.1 Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux test resu

[PHP] php array in different OS

2010-07-20 Thread fyang
Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: "; } echo "count:",count($data); ?> OS1: Red Hat Enterprise Linux Server release 5.1 Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux test resu

[PHP] php array in different OS

2010-07-20 Thread fyang
Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: "; } echo "count:",count($data); ?> OS1: Red Hat Enterprise Linux Server release 5.1 Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux test resu

Re: [PHP] Array form processing

2010-06-30 Thread tedd
At 4:54 PM -0400 6/29/10, Ron Piggott wrote: I am trying to process a form where the user uses checkboxes: Sharp Stabbing Jabbing When I do: foreach($_REQUEST as $key => $val) { $$key = $val; echo $key . ": " . $val . ""; } The output is: painDesc: Array I need to know the val

RE: [PHP] Array form processing

2010-06-30 Thread Ford, Mike
> -Original Message- > From: Ron Piggott [mailto:ron.pigg...@actsministries.org] > Sent: 29 June 2010 22:22 > > Am I on the right track? I don't know what to do with the second > "FOREACH" Sort of. > > > foreach($_REQUEST as $key => $val) { > $$key = $val; >echo $key . "

Re: [PHP] Array form processing

2010-06-29 Thread Jim Lucas
Ron Piggott wrote: > I am trying to process a form where the user uses checkboxes: > > Sharp > Stabbing > Jabbing > > When I do: > > foreach($_REQUEST as $key => $val) { > $$key = $val; >echo $key . ": " . $val . ""; > } > > The output is: > > painDesc: Array > > I need to know t

Re: [PHP] Array form processing

2010-06-29 Thread Ron Piggott
Am I on the right track? I don't know what to do with the second "FOREACH" $val) { $$key = $val; echo $key . ": " . $val . ""; if ( $val == "Array" ) { $i=0; foreach ($val) { echo "$val[$i]";

Re: [PHP] Array form processing

2010-06-29 Thread Shreyas Agasthya
The painDesc array is what that should be iterated. --Shreyas On Wed, Jun 30, 2010 at 2:27 AM, Ashley Sheridan wrote: > On Tue, 2010-06-29 at 16:54 -0400, Ron Piggott wrote: > > > I am trying to process a form where the user uses checkboxes: > > > > Sharp > > Stabbing > > Jabbing > > > > When I

  1   2   3   4   5   6   7   8   9   10   >