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 help.

2012-10-24 Thread Paul Halliday
] 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 this path and it isn't working as expected. Drawing

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'); $ocTest = explode(., $ip); $groupKeys = array_keys($groupMappings); $groupTest = array_search

Re: [PHP] Array unset()

2012-09-24 Thread Ashley Sheridan
Ken Robinson kenrb...@rbnsn.com 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 to

[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 account

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

Re: [PHP] PHP array unions

2012-09-14 Thread Matijn Woudt
Op 14 sep. 2012 07:51 schreef Adam Richardson simples...@gmail.com het volgende: On Wed, Sep 12, 2012 at 2:37 PM, Sebastian Krebs krebs@gmail.com 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

Re: [PHP] PHP array unions

2012-09-14 Thread Adam Richardson
On Fri, Sep 14, 2012 at 2:30 AM, Matijn Woudt tijn...@gmail.com 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

Re: [PHP] PHP array unions

2012-09-13 Thread Adam Richardson
On Wed, Sep 12, 2012 at 2:37 PM, Sebastian Krebs krebs@gmail.com 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

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

[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

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

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, Ash

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 nam.gi...@gmail.com 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',    ... )

[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,

[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 Louis Huppenbauer
-- Forwarded message -- From: Louis Huppenbauer louis.huppenba...@gmail.com Date: 2011/10/31 Subject: Re: [PHP] Novice: PHP array by reference question (by C++ programmer) To: Manish Gupta gman...@gmail.com You have to assign the value by reference too public function

[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 to

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 nam.gi...@gmail.com 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',    ...

[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) {

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 marc.fr...@wwu.edu wrote: I am reading a csv file into an array. The csv file. users.csv file contents: w12345678,a w23456789,b w34567890,c

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 Adam Balogh
hi, try to use print_r or var_dump to echo compound data type

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 marc.fr...@wwu.edu wrote: I am reading a csv file into an

[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($bla);

[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 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-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 it has

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

[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 from one form to other?

2011-02-19 Thread Daniel Brown
On Sat, Feb 19, 2011 at 19:38, Yogesh yogesh...@gmail.com 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

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 danbr...@php.net wrote: On Sat, Feb 19, 2011 at 19:38, Yogesh yogesh...@gmail.com 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

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

2011-02-19 Thread Daniel Brown
On Sat, Feb 19, 2011 at 21:50, Yogesh yogesh...@gmail.com wrote: POST Use cURL, look into curl_setopt(), and add square brackets (and optional key names) to your array. A quick start: ?php $ch = curl_init(); curl_setopt(CURLOPT_POST,1);

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

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

[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 to var - with different name

2011-01-20 Thread Daniel Molina Wegener
On Thursday 20 January 2011, Donovan Brooke li...@euca.us 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

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 (tediously) did

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 tommy...@gmail.com 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

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)} =

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 as $key = $value) $$key = $value; short

Re: [PHP] Array Symbol Suggestion

2011-01-13 Thread Richard Quadling
On 12 January 2011 20:23, 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, it

Re: [PHP] Array Symbol Suggestion

2011-01-13 Thread David Harkness
On Thu, Jan 13, 2011 at 2:23 AM, Richard Quadling rquadl...@gmail.comwrote: 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

Re: [PHP] Array Symbol Suggestion

2011-01-13 Thread David Hutto
On Thu, Jan 13, 2011 at 12:59 PM, David Harkness davi...@highgearmedia.com wrote: On Thu, Jan 13, 2011 at 2:23 AM, Richard Quadling rquadl...@gmail.comwrote: 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

Re: [PHP] Array Symbol Suggestion

2011-01-13 Thread David Harkness
On Thu, Jan 13, 2011 at 10:07 AM, David Hutto smokefl...@gmail.com 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

[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 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

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

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 was

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's

Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Daniel Brown
On Wed, Jan 12, 2011 at 14:45, 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

Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Michael Shadle
On Wed, Jan 12, 2011 at 12:37 PM, Daniel Brown danbr...@php.net 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

Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Daniel Brown
On Wed, Jan 12, 2011 at 15:41, Michael Shadle mike...@gmail.com wrote: On Wed, Jan 12, 2011 at 12:37 PM, Daniel Brown danbr...@php.net 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

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 to, but

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:

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 li...@cmsws.com wrote: On 12/17/2010 12:52 PM, Sorin

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 =

[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 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

Re: [PHP] array question

2010-12-17 Thread Daniel Brown
On Fri, Dec 17, 2010 at 15:52, Sorin Buturugeanu m...@soin.ro 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

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 http://www.facebook.com/buturugeanu

Re: [PHP] Array problem

2010-10-28 Thread Richard Quadling
On 27 October 2010 22:15, Kevin Kinsey k...@daleco.biz 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

RE: [PHP] Array problem

2010-10-28 Thread Bob McConnell
From: Richard Quadling On 27 October 2010 22:15, Kevin Kinsey k...@daleco.biz 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

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

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 gift;

[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 if

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

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. input type=submit name=submit value=Remove class=place_order/ What I am struggling with is to find an effective

Re: [PHP] Array / form processing

2010-10-07 Thread chris h
input type=submit name=submit value=Remove class=place_order/ 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. form target=... action=... input type=hidden name=submit value=Remove / input type=hidden name=product_so

Re: [PHP] Array question

2010-09-26 Thread a...@ashleysheridan.co.uk
was explicitly created, php made the next one at 3. Thanks, Ash http://www.ashleysheridan.co.uk - Reply message - From: chris h chris...@gmail.com Date: Sat, Sep 25, 2010 22:05 Subject: [PHP] Array question To: MikeB mpbr...@gmail.com Cc: php-general@lists.php.net Mike, $results

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

[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 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 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); switch

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 =

Re: [PHP] Array help.

2010-07-30 Thread Paul Halliday
On Fri, Jul 30, 2010 at 3:44 PM, Joshua Kehn josh.k...@gmail.com 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

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 order by status desc;

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 fy...@ipp.ac.cn: Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: ?php $n= 5; for($i=0;$i$n;$i++) {

[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

[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

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: ?php $n= 5; for($i=0;$i$n;$i++) { $data[]=array(,$i,$i/1000); echo $i, ,$data[$i][1],br; }

Re: [PHP] php array in different OS

2010-07-21 Thread fyang
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 simple test

[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: ?php $n= 5; for($i=0;$i$n;$i++) { $data[]=array(,$i,$i/1000); echo $i, ,$data[$i][1],br; } echo

[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: ?php $n= 5; for($i=0;$i$n;$i++) { $data[]=array(,$i,$i/1000); echo $i, ,$data[$i][1],br; } echo

[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: ?php $n= 5; for($i=0;$i$n;$i++) { $data[]=array(,$i,$i/1000); echo $i, ,$data[$i][1],br; } echo

[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: ?php $n= 5; for($i=0;$i$n;$i++) { $data[]=array(,$i,$i/1000); echo $i, ,$data[$i][1],br; } echo

[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: ?php $n= 5; for($i=0;$i$n;$i++) { $data[]=array(,$i,$i/1000); echo $i, ,$data[$i][1],br; } echo

[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: ?php $n= 5; for($i=0;$i$n;$i++) { $data[]=array(,$i,$i/1000); echo $i, ,$data[$i][1],br; } echo

[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: ?php $n= 5; for($i=0;$i$n;$i++) { $data[]=array(,$i,$i/1000); echo $i, ,$data[$i][1],br; } echo

[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: ?php $n= 5; for($i=0;$i$n;$i++) { $data[]=array(,$i,$i/1000); echo $i, ,$data[$i][1],br; } echo

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. ?php foreach($_REQUEST as $key = $val) { $$key = $val; echo $key . : . $val

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: input type=checkbox name=painDesc[] value=1 /Sharp input type=checkbox name=painDesc[] value=2 /Stabbing input type=checkbox name=painDesc[] value=3 /Jabbing When I do: foreach($_REQUEST

[PHP] Array form processing

2010-06-29 Thread Ron Piggott
I am trying to process a form where the user uses checkboxes: input type=checkbox name=painDesc[] value=1 /Sharp input type=checkbox name=painDesc[] value=2 /Stabbing input type=checkbox name=painDesc[] value=3 /Jabbing When I do: foreach($_REQUEST as $key = $val) { $$key = $val;

Re: [PHP] Array form processing

2010-06-29 Thread Ashley Sheridan
On Tue, 2010-06-29 at 16:54 -0400, Ron Piggott wrote: I am trying to process a form where the user uses checkboxes: input type=checkbox name=painDesc[] value=1 /Sharp input type=checkbox name=painDesc[] value=2 /Stabbing input type=checkbox name=painDesc[] value=3 /Jabbing When I do:

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 a...@ashleysheridan.co.ukwrote: On Tue, 2010-06-29 at 16:54 -0400, Ron Piggott wrote: I am trying to process a form where the user uses checkboxes: input type=checkbox

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 ?php foreach($_REQUEST as $key = $val) { $$key = $val; echo $key . : . $val . br; if ( $val == Array ) { $i=0; foreach ($val) {

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: input type=checkbox name=painDesc[] value=1 /Sharp input type=checkbox name=painDesc[] value=2 /Stabbing input type=checkbox name=painDesc[] value=3 /Jabbing When I do: foreach($_REQUEST as $key = $val) {

[PHP] array key's: which is correct?

2010-06-08 Thread Tanel Tammik
Hi, which one is correct or better? $array[3] = ''; or $array['3'] = ''; $i = 7; $array[$i] = ''; or $array[$i] = ''; Br Tanel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] array key's: which is correct?

2010-06-08 Thread Paul M Foster
On Tue, Jun 08, 2010 at 04:12:42PM +0300, Tanel Tammik wrote: Hi, which one is correct or better? $array[3] = ''; or $array['3'] = ''; If the index for (integer) 3, the first example is correct. If the index is (string) '3', the second example is correct. $i = 7; $array[$i] = '';

Re: [PHP] array key's: which is correct?

2010-06-08 Thread Ashley Sheridan
On Tue, 2010-06-08 at 16:12 +0300, Tanel Tammik wrote: Hi, which one is correct or better? $array[3] = ''; or $array['3'] = ''; $i = 7; $array[$i] = ''; or $array[$i] = ''; Br Tanel The two indexes are equivalent, although I reckon the integer one will give better

  1   2   3   4   5   6   7   8   9   10   >