Re: [PHP] array insights

2006-05-03 Thread Robert Cummings
On Wed, 2006-05-03 at 13:27, Dave Goodchild wrote: use: $new_array = array_chunk($input_array, 3)); this will split your original array into a number of arrays with three elements in each and trash the original keys. If you want to preserve the keys pass a third paramater (true). Hope

Re: [PHP] array insights

2006-05-03 Thread Jason Gerfen
Dave Goodchild wrote: use: $new_array = array_chunk($input_array, 3)); Thanks, that is just the array function I was looking for. this will split your original array into a number of arrays with three elements in each and trash the original keys. If you want to preserve the keys pass a

Re: [PHP] array insights

2006-05-03 Thread Robert Cummings
On Wed, 2006-05-03 at 13:42, Jason Gerfen wrote: Dave Goodchild wrote: use: $new_array = array_chunk($input_array, 3)); Thanks, that is just the array function I was looking for. Really? Wow! That'll produce nothing like the example you said you wanted. *lol* Cheers, Rob. --

Re: [PHP] array problem

2006-04-23 Thread Brian V Bonini
On Sat, 2006-04-22 at 15:31, Martin Alterisio wrote: You're wrong, he isn't using an associative array, since the keys used are only integers. Well, if you really want to argue semantics then technically we're both wrong because there are no different indexed and associative array types in PHP,

Re: [PHP] array problem + humor (all those with joke allergies beware)

2006-04-23 Thread Brian V Bonini
On Sat, 2006-04-22 at 14:16, Jochem Maas wrote: with regard to Suresh - do you, Brian, know how many times he has posted similar question to this list this year? (this is the first time he has even given an indication that he knows where the manual is let alone opened it btw) do you know

Re: [PHP] array problem + humor (all those with joke allergies beware)

2006-04-23 Thread Dave Goodchild
Tiresome. On 23/04/06, Brian V Bonini [EMAIL PROTECTED] wrote: On Sat, 2006-04-22 at 14:16, Jochem Maas wrote: with regard to Suresh - do you, Brian, know how many times he has posted similar question to this list this year? (this is the first time he has even given an indication that

[PHP] array problem

2006-04-22 Thread suresh kumar
sorry.earlier i mistyped some values. I am facing one project in my project . this is my code: a=array(0=10,1=10,2=40,3=30,4=30,5=10); b=array(); b=array_unique($a); print_r($b); o/p getting from above code is b[0]=10,b[2]=40,b[3]=30,b[5]=10; but i want the

Re: [PHP] array problem

2006-04-22 Thread Brian V Bonini
On Sat, 2006-04-22 at 07:09, suresh kumar wrote: sorry.earlier i mistyped some values. I am facing one project in my project . this is my code: a=array(0=10,1=10,2=40,3=30,4=30,5=10); b=array(); b=array_unique($a); print_r($b); o/p getting from above code

Re: [PHP] array problem + humor (all those with joke allergies beware)

2006-04-22 Thread Jochem Maas
suresh kumar wrote: sorry.earlier i mistyped some values. I am facing one project in my project . this is my code: a=array(0=10,1=10,2=40,3=30,4=30,5=10); b=array(); b=array_unique($a); print_r($b); o/p getting from above code is b[0]=10,b[2]=40,b[3]=30,b[5]=10;

Re: [PHP] array problem + humor (all those with joke allergies beware)

2006-04-22 Thread Brian V Bonini
Jochem's site: snip http://iamjochem.com/mariecke/index.php Mariecke's daily ramblings (almost) in dutch english... this page is using output from a drupal system. If nothing else they have a nice logo. ;) Warning: main(./../blog/parse.php): failed to open stream: No such file or directory

Re: [PHP] array problem + humor (all those with joke allergies beware)

2006-04-22 Thread Jochem Maas
thanks Brian. that site has not worked for, oh, 3 years - I don't see what some broken code on some site I haven't done anything with in years has got to do with programmer ethic (or whatever advice you were refering to). - am I bugging you for a fix? with regard to Suresh - do you, Brian, know

Re: [PHP] array problem

2006-04-22 Thread Martin Alterisio
You're wrong, he isn't using an associative array, since the keys used are only integers. array(10,10,40,30,30,10); and array(0=10,1=10,2=40,3=30,4=30,5=10); create the same array. The problem is that array_unique preserves keys (read the manual!!!) If you don't want this, use array_values() to

[PHP] Array Question

2006-03-29 Thread cybermalandro cybermalandro
So, I have an array that looks like this rray(3) { [0]= array(8) { [line]= string(1) 1 [ponbr]= string(5) 34474 [emt]= string(3) yes [qty]= string(1) 5 [price]= string(2) 19 [shipdate]= string(8) 11/06/07 [tracking]= string(17)

[PHP] Array Question again

2006-03-29 Thread cybermalandro cybermalandro
Let me try this again. I want to take an array that may look like this array(2) { [0]= array(8) { [line]= string(1) 1 [ponbr]= string(5) TEST1 [emt]= string(3) yes [qty]= string(1) 5 [price]= string(2) 19 [shipdate]= string(8) 12/04/06

[PHP] Array sort question

2006-02-28 Thread PHP
Hi, How can I sort a 2 dimensional array by number of elements? Ex: rgArray[0] = ("1","2"); rgArray[1] = ("1"); rgArray[2] = ("1","2","3","4"); rgArray[3] = ("1","2","3"); Now I would like to sort it so I can loop through them from least elements to most (or vice versa): rgArray[1] (now

RE: [PHP] Array sort question

2006-02-28 Thread jblanchard
[snip] How can I sort a 2 dimensional array by number of elements? [/snip] Start by RTFM http://www.php.net/manual/en/function.count.php

Re: [PHP] Array sort question

2006-02-28 Thread Jeremy Privett
[EMAIL PROTECTED] wrote: [snip] How can I sort a 2 dimensional array by number of elements? [/snip] Start by RTFM http://www.php.net/manual/en/function.count.php I love how infinitely helpful people on this mailing list are. It's a wonder people are being turned off to PHP. There's

RE: [PHP] Array sort question

2006-02-28 Thread jblanchard
[snip] I love how infinitely helpful people on this mailing list are. It's a wonder people are being turned off to PHP. There's no one here willing to help new people more than throwing them RTFM responses. [/snip] Are you new here? I would rather teach a man how to fish than give him his supper

Re: [PHP] Array sort question

2006-02-28 Thread Saline Erik
Sometimes I just need a point in the right direction. So RTFM is not so bad. Erik On Feb 28, 2006, at 11:26 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: [snip] I love how infinitely helpful people on this mailing list are. It's a wonder people are being turned off to PHP. There's no

Re: [PHP] Array sort question

2006-02-28 Thread Jeremy Privett
[EMAIL PROTECTED] wrote: [snip] I love how infinitely helpful people on this mailing list are. It's a wonder people are being turned off to PHP. There's no one here willing to help new people more than throwing them RTFM responses. [/snip] Are you new here? I would rather teach a man how to

Re: [PHP] Array sort question

2006-02-28 Thread Jeremy Privett
Saline Erik wrote: Sometimes I just need a point in the right direction. So RTFM is not so bad. Erik If you say so. In that case, jblanchard, I apologize for my outburst. -- Jeremy Privett Director of Product Development Zend Certified Engineer Completely Unique [EMAIL PROTECTED] Phone:

Re: [PHP] Array sort question

2006-02-28 Thread John Nichel
Jeremy Privett wrote: [EMAIL PROTECTED] wrote: [snip] How can I sort a 2 dimensional array by number of elements? [/snip] Start by RTFM http://www.php.net/manual/en/function.count.php I love how infinitely helpful people on this mailing list are. It's a wonder people are being

RE: [PHP] Array sort question

2006-02-28 Thread jblanchard
[snip] If you say so. In that case, jblanchard, I apologize for my outburst. [/snip] Apology accepted. Look, several of us have been on this list for years and have helped several others through their issues. Mailing lists like this (try a C++ newsgroup for example) are much more merciless than

Re: [PHP] Array sort question

2006-02-28 Thread Robin Vickery
On 28/02/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: The array sorting suggestions you provide will not sort based on the number of items in each array, which is what the OP wanted. That's not entirely fair. I would have said his usort() suggestion was a better pointer than a link to count()

RE: [PHP] Array sort question

2006-02-28 Thread jblanchard
[snip] That's not entirely fair. I would have said his usort() suggestion was a better pointer than a link to count() - which gives no hint as to how to sort the list, which is after all what the OP's trying to do. ObSuggestion: function byLength($a, $b) { return sizeof($a) - sizeof($b); }

RE: [PHP] Array sort question

2006-02-28 Thread tedd
snip I would rather teach a man how to fish than give him his supper on a silver platter. /snip Write his code and you can reduce his frustration for a day, but teach him to program and you'll frustrate him for life. tedd --

[PHP] (array)

2006-02-22 Thread Jay Paulson
Just came across some code I haven't seen before and can't find anything on php.net or google about it (maybe I'm not searching for the right thing?). What is the following doing? // $dataobject is holding a bunch of variables like: // $dataobject-var1 // $dataobject-var2 // etc...

Re: [PHP] (array)

2006-02-22 Thread John Nichel
Jay Paulson wrote: Just came across some code I haven't seen before and can't find anything on php.net or google about it (maybe I'm not searching for the right thing?). What is the following doing? // $dataobject is holding a bunch of variables like: // $dataobject-var1 //

Re: [PHP] (array)

2006-02-22 Thread Ray Hauge
On Wednesday 22 February 2006 15:09, John Nichel wrote: Jay Paulson wrote: Just came across some code I haven't seen before and can't find anything on php.net or google about it (maybe I'm not searching for the right thing?). What is the following doing? // $dataobject is holding a

[PHP] array variables with or without quotes

2006-02-21 Thread 2dogs
I recently encountered a situation where I had to retrieve data from a MYSQL database table with a field named include. My code looked like this: $content_result = mysql_query('SELECT * FROM calander') or die(mysql_error()); $content_row = mysql_fetch_array($content_result); if

Re: [PHP] array variables with or without quotes

2006-02-21 Thread Chris
When I tried to run this, PHP treated the word -include- as a control structure rather than an index name. Understandable. So, I put it in single quotes ('include') to see what would happen and it works fine. But I don't understand why! What is the difference between $content_row [include]

[PHP] Array sizes?

2006-02-08 Thread Anders Norrbring
Maybe I'm just blind, but I can't find any way to count an array size in bytes? I have a quite big array with multiple data formats in it, and I would like to know how big it is in bytes... -- Anders Norrbring -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Array sizes?

2006-02-08 Thread tedd
Maybe I'm just blind, but I can't find any way to count an array size in bytes? I have a quite big array with multiple data formats in it, and I would like to know how big it is in bytes... -- Anders Norrbring Yeah, I know -- sizeof is simply count, which doesn't solve the problem. You

[PHP] array of checkbox values

2006-01-11 Thread Sjef Janssen
Hallo, I have a form with a number of checkboxes grouped together. The value of these boxes is stored in an array: $used[]. Now I found that the value of checked boxes (value = 'Y') are stored in the array while non checked boxes are not stored at all. This makes the array incomplete as I want to

RE: [PHP] array of checkbox values

2006-01-11 Thread Jim Moseby
Hallo, I have a form with a number of checkboxes grouped together. The value of these boxes is stored in an array: $used[]. Now I found that the value of checked boxes (value = 'Y') are stored in the array while non checked boxes are not stored at all. This makes the array incomplete as

Re: [PHP] array to object conversion

2005-12-15 Thread Jochem Maas
Cyril wrote: Is there any way of converting an array to an object of a type/class other than stdClass? write a function? - bare in mind this is just an idea - it would need more work to make it usuable (and the code is completely untested): class Test {} function castFromArray($class, $arr) {

[PHP] array to object conversion

2005-12-14 Thread Cyril
Is there any way of converting an array to an object of a type/class other than stdClass? I have been using the new PDO system and have experimented with fetching rows with PDO::FETCH_CLASS I would quite like to do the same with a plain array. Any comments appreciated. Cyril -- PHP General

[PHP] array carrying from one php page to another

2005-12-07 Thread Eternity Records Webmaster
I have an array $journal that I want to carry from a page (where it was created) to another page (a popup that shows the variables contents). Is this automatically available? or do I have to do something special to php?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] array carrying from one php page to another

2005-12-07 Thread Curt Zirzow
?? It can be sort of automatically: ?php $array = array('my', 'list', 'of', 'stuff'); $_SESSION['array_for_popup'] = $array; ? And in the code that is called in the popup: ?php if(!isset($_SESSION['array_for_popup']) { die('you should not be here anyway, only on a popup is this allowed

Re: [PHP] array carrying from one php page to another

2005-12-07 Thread Ligaya Turmelle
Session variable or hidden field maybe Eternity Records Webmaster wrote: I have an array $journal that I want to carry from a page (where it was created) to another page (a popup that shows the variables contents). Is this automatically available? or do I have to do something special to php??

Re: [PHP] array carrying from one php page to another

2005-12-07 Thread Zack Bloom
you could just pass in in the address, eg: www.example.com?var1=$var1var2=$var2 to get them use $_REQUEST['var1'] to pass an array you could use serialize($var1) and unserialize($var1) On 12/8/05, Chris Shiflett [EMAIL PROTECTED] wrote: Curt Zirzow wrote: ?php $array = array('my', 'list

Re: [PHP] array carrying from one php page to another

2005-12-07 Thread Chris Shiflett
Curt Zirzow wrote: ?php $array = array('my', 'list', 'of', 'stuff'); $_SESSION['array_for_popup'] = $array; ? And in the code that is called in the popup: ?php if(!isset($_SESSION['array_for_popup']) { die('you should not be here anyway, only on a popup is this allowed'); } $array

Re: [PHP] array carrying from one php page to another

2005-12-07 Thread Curt Zirzow
On Thu, Dec 08, 2005 at 02:39:46AM -0500, Zack Bloom wrote: you could just pass in in the address, eg: www.example.com?var1=$var1var2=$var2 to get them use $_REQUEST['var1'] to pass an array you could use serialize($var1) and unserialize($var1) Or just use http_build_query() (php5 only)

[PHP] array woes

2005-11-25 Thread blackwater dev
Hello all, I have some array code driving me nuts. I am pulling from a db: select id, vehicle, has_quotes from cars where active=1 I then loop through these and build an array that contains the id's and cars. while($res){ $cars[$res[id]]=$res[vehicle]; //here is the problem, when has_quotes

Re: [PHP] Array - partical path to the array's path (part 2)

2005-10-03 Thread Scott Fletcher
Got it figured out by now. I noticed one small bug but I'll fix it monday morning, so i'm going to post what I did to make this work.. I'm going to donate this code to the guy at http://www.devdump.com/phpxml.php and hopefully he'll put some of this to a good use as more and more people are now

Re: [PHP] Array: If i'm in the child array then how I tell the parent's key name..

2005-10-01 Thread Ing . Josué Aranda
Scott, I hope this code help you: [PHP CODE] /* * Author: * Josue Aranda [EMAIL PROTECTED] */ // This set an $arr $arr= array( 'ABC' = array( 'DEF' = 'Data'

[PHP] Array within array

2005-09-30 Thread Chris
Greetings PHP community, I have a CSV text file which I need to use to update existing DB records. So I have the following : $array_file = file(path/to/file); file() creates an array comprising each line of the file, but if each line contains 20 or so CS values, how do I go about reading each

Re: [PHP] Array within array

2005-09-30 Thread Emil Novak
?php $array_file = file(path/to/file); foreach($array_file as $line) { $e_array = explode(',',$line); { // do update on db for each line of array } } ? Like this? Emil Novak, Slovenia, EU -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

Re: [PHP] Array within array

2005-09-30 Thread Chris Blake
On Fri, 2005-09-30 at 15:33, Emil Novak wrote: ?php $array_file = file(path/to/file); foreach($array_file as $line) { $e_array = explode(',',$line); { // do update on db for each line of array } } ? Like this? Hi Emil, That`s exactly how I figured it

[PHP] Array: If i'm in the child array then how I tell the parent's key name..

2005-09-30 Thread Scott Fletcher
Suppose that I'm in a child array and I wanna know how do I tell what key is the parent's level, one level up... For example, --snip-- $arr['ABC']['DEF']; --snip-- Let's say the child is DEF then the key name one level up would be ABC. How do I determine the one level up? Thanks... -- PHP

Re: [PHP] Array Select from database

2005-09-29 Thread Robin Vickery
On 9/28/05, Silvio Porcellana [EMAIL PROTECTED] wrote: In addiction, I would (SQL)escape the values joined: supposing you are using MySQL, I'd do: $values = join(', ', array_map('mysql_real_escape_string', $array)); I agree entirely; I was just trying to keep things simple for the OP.

Re: [PHP] Array - partical path to the array's path (part 2)

2005-09-29 Thread Scott Fletcher
the xml above is not structurally the same as the array below I'll bet your output has just one message element right? or you have gone completely offtrack. might be time you went here: http://php.net/xml http://php.net/dom http://php.net/domxml might be something there to help

[PHP] Array: how to find a parent key when using a child key?

2005-09-29 Thread Scott Fletcher
I'm using the recursive function and it use the foreach() loop. I can figure out how to use the current key but I could not figure out how to use the parent's key. Can anyone point out to what I'm missing here? Just look at the //Parent Key - How?? comment in the script...I'm not sure what

[PHP] Array Select from database

2005-09-28 Thread Frank Keessen
Hi All, Hope you can help me out.. Array ( [count] = 1 [0] = Array ( [clientaccountmanager] = Array ( [count] = 2 [0] = 210 [1] = 149 ) I've got the following Query=select * from client WHERE clientaccountmanager='$value of array1' OR '$2nd value of array 1' So that the query loops through the

RE: [PHP] Array Select from database

2005-09-28 Thread Jay Blanchard
[snip] Hope you can help me out.. Array ( [count] = 1 [0] = Array ( [clientaccountmanager] = Array ( [count] = 2 [0] = 210 [1] = 149 ) I've got the following Query=select * from client WHERE clientaccountmanager='$value of array1' OR '$2nd value of array 1' So that the query loops through the

Re: [PHP] Array Select from database

2005-09-28 Thread Frank Keessen
O.K. Again; I have an array with one or more values, which must be selected in the database Array ( [count] = 1 [0] = Array ( [clientaccountmanager] = Array ( [count] = 2 [0] = 210 [1] = 149 ) Now i this is my select.. I've got the following Query=select * from client WHERE

Re: [PHP] Array Select from database

2005-09-28 Thread Robin Vickery
On 9/28/05, Frank Keessen [EMAIL PROTECTED] wrote: O.K. Again; I have an array with one or more values, which must be selected in the database Array ( [count] = 1 [0] = Array ( [clientaccountmanager] = Array ( [count] = 2 [0] = 210 [1] = 149 ) Now i this is my select.. I've got the

Re: [PHP] Array Select from database

2005-09-28 Thread A.J. Brown
There is a small bug in your code: [snip] $values = join(', ', $array); $query = SELECT * FROM client WHERE clientaccountmanager IN ($values) [/snip] You'll need to surround $values with a single quote after joining: [code] $values = join(', ', $array); $query = SELECT * FROM client WHERE

Re: [PHP] Array - partical path to the array's path (part 2)

2005-09-28 Thread Scott Fletcher
To the top... Aw!!! This is driving me nut... I can't get it to do what I want it to do... Also, another problem is that we're all not thinking at the same level so I'll just dump the simple code so you all can see what I'm trying to do... [code] function getVal($arr, $path) {

Re: [PHP] Array Select from database

2005-09-28 Thread Silvio Porcellana
A.J. Brown wrote: [code] $values = join(', ', $array); $query = SELECT * FROM client WHERE clientaccountmanager IN ('$values') [/code] Actually this doesn't seem right, the join should be: $values = join(', ', $array); # notice the ' inside the In addiction, I would (SQL)escape the

RE: [PHP] Array Select from database

2005-09-28 Thread Chris W. Parker
Silvio Porcellana mailto:[EMAIL PROTECTED] on Wednesday, September 28, 2005 9:37 AM said: In addiction, I would (SQL)escape the values joined: supposing you are using MySQL, I'd do: $values = join(', ', array_map('mysql_real_escape_string', $array)); Now that's a Freudian slip if I ever

Re: [PHP] Array - partical path to the array's path (part 2)

2005-09-28 Thread Jochem Maas
Scott Fletcher wrote: To the top... Aw!!! This is driving me nut... I can't get it to do what I want it to do... Also, another problem is that we're all not thinking at the same level so I'll just dump the simple code so you all can see what I'm trying to do... [code] fantastic function -

Re: [PHP] Array - partical path to the array's path (part 2)

2005-09-28 Thread Scott Fletcher
Aw!!! This is driving me nut... It still does :-) get to grips with var_dump() ... Um Interesting thought... ($array.$suffix) will never be an array $suffix .= ['.$key.']; Yea, you are correct... I was trying to integrate the coding and stumpled upon this. It's a

Re: [PHP] Array - partical path to the array's path (part 2)

2005-09-28 Thread Jochem Maas
Scott Fletcher wrote: Aw!!! This is driving me nut... It still does :-) get to grips with var_dump() ... Um Interesting thought... ($array.$suffix) will never be an array $suffix .= ['.$key.']; Yea, you are correct... I was trying to integrate the coding and stumpled

[PHP] Array - partical path to the array's path....

2005-09-27 Thread Scott Fletcher
Here is something simple that I want it to work.. Not sure how to do this exactly... Code #1 [code] $array = array(); $array['col1']['col2'] = Test #1; $array['col3']['col2'] = Test #2; echo $array['col3']['col2']; //Spitted out result as Test #2... [/code] What I want this to work

Re: [PHP] Array - partical path to the array's path....

2005-09-27 Thread Silvio Porcellana
Scott Fletcher wrote: What I want this to work instead is [code] $array = array(); $array['col1']['col2'] = Test #1; $array['col3']['col2'] = Test #2; $prefix = ['col3']['col2']; echo $array.$prefix; //Spitted out result as Test #2... [/code] Try something like this: code $var

Re: [PHP] Array - partical path to the array's path....

2005-09-27 Thread Mike Dunlop
On Sep 27, 2005, at 10:22 AM, Scott Fletcher wrote: [code] $array = array(); $array['col1']['col2'] = Test #1; $array['col3']['col2'] = Test #2; $prefix = ['col3']['col2']; echo $array.$prefix; //Spitted out result as Test #2... [/code] This is the simple code that I'm trying to

Re: [PHP] Array - partical path to the array's path....

2005-09-27 Thread Jochem Maas
Mike Dunlop wrote: On Sep 27, 2005, at 10:22 AM, Scott Fletcher wrote: [code] $array = array(); $array['col1']['col2'] = Test #1; $array['col3']['col2'] = Test #2; $prefix = ['col3']['col2']; echo $array.$prefix; //Spitted out result as Test #2... [/code] This is the simple code

Re: [PHP] Array - partical path to the array's path....

2005-09-27 Thread Scott Fletcher
Wow, that seem to work... Should have use $suffix instead of $prefix to make it less confusing. Silvio Porcellana [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Scott Fletcher wrote: What I want this to work instead is [code] $array = array(); $array['col1']['col2'] = Test

Re: [PHP] Array - partical path to the array's path....

2005-09-27 Thread Scott Fletcher
Jochem Maas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Mike Dunlop wrote: On Sep 27, 2005, at 10:22 AM, Scott Fletcher wrote: [code] $array = array(); $array['col1']['col2'] = Test #1; $array['col3']['col2'] = Test #2; $prefix = ['col3']['col2'];

Re: [PHP] Array - partical path to the array's path....

2005-09-27 Thread Jochem Maas
see below.. Scott Fletcher wrote: Jochem Maas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Mike Dunlop wrote: On Sep 27, 2005, at 10:22 AM, Scott Fletcher wrote: [code] $array = array(); $array['col1']['col2'] = Test #1; $array['col3']['col2'] = Test #2; $prefix =

Re: [PHP] Array - partical path to the array's path....

2005-09-27 Thread Mike Dunlop
My bad - that doesn't work - that came off the top off my head. It sure did look sexy though, no ? - MD echo ${array.$prefix}; really? did you test that? doesn't work when I do it (the second expression does - but doesn't answer the OPs question actually imho the answer is not eval()

Re: [PHP] Array - partical path to the array's path....

2005-09-27 Thread Scott Fletcher
:-) Mike Dunlop [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] My bad - that doesn't work - that came off the top off my head. It sure did look sexy though, no ? - MD echo ${array.$prefix}; really? did you test that? doesn't work when I do it (the second expression

Re: [PHP] Array - partical path to the array's path....

2005-09-27 Thread Scott Fletcher
see below... Jochem Maas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] see below.. Scott Fletcher wrote: Jochem Maas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Mike Dunlop wrote: On Sep 27, 2005, at 10:22 AM, Scott Fletcher wrote: [code] $array =

[PHP] array simple question

2005-09-13 Thread matt VanDeWalle
hello, I have a simple question, not really a problem this time. I know that the function print_r() will print an array but if that array has sub-arrays it prints everything and if you don't use more command or a pipe of some kind that could be useless in some cases, but I am just wondering,

Re: [PHP] array simple question

2005-09-13 Thread [EMAIL PROTECTED]
tray print the array this way: echo 'pre'; print_r($array); echo '/pre'; -afan matt VanDeWalle wrote: hello, I have a simple question, not really a problem this time. I know that the function print_r() will print an array but if that array has sub-arrays it prints everything and if you

Re: [PHP] array simple question

2005-09-13 Thread Jordan Miller
please provide code and an example output, and say how this is different than you would like. what you describe is unclear. Jordan On Sep 13, 2005, at 4:04 PM, matt VanDeWalle wrote: hello, I have a simple question, not really a problem this time. I know that the function print_r() will

Re: [PHP] array simple question

2005-09-13 Thread Jasper Bryant-Greene
it to not preserve keys. ?php $array = array( 'this', 'is', 'my', array( 'array' ) ); $newArray = array(); foreach( $array as $key=$value ) { if( !is_array( $value ) ) { $newArray[$key] = $value; } } print( 'pre' . print_r( $newArray, true ) . '/pre' ); ? -- Jasper Bryant

Re: [PHP] array simple question

2005-09-13 Thread Mike Bellerby
If you want to print the keys for all the arrays in the main array then use allkeys. matt VanDeWalle wrote: hello, I have a simple question, not really a problem this time. I know that the function print_r() will print an array but if that array has sub-arrays it prints everything and if

[PHP] array question: fixed

2005-09-13 Thread matt VanDeWalle
hey, thanks for jogging my memory about the array_keys ; that was exactly what i wanted, now I don't have to run the program through the more program now, and i got all the names of the arrays in the big array without having half of the info scrolling off the screen. thanks matt -- PHP

Re: [PHP] array varible problems

2005-09-03 Thread edwardspl
Hello, I have just rewrite the source and test the result... But it is still problem ! So, more help ? Thanks ! [EMAIL PROTECTED] wrote: Hello Jasper, Does your means : I need to rewite the source / result page as the following ? Result page: ? for($i=0;$i4;$i++) {

[PHP] array merge problem

2005-09-01 Thread Ahmed Abdel-Aliem
i have the array with the following structure : Array ( [19] = 20.00 [25] = 20.00 [7] = 30.00 [17] = 30.00 ) when i merge a field to it using array_merge it returns that : Array ( [0] = 20.00 [1] = 20.00 [2] = 30.00 [3] = 30.00 [4] = 200.00 ) how can i merge

RE: [PHP] array merge problem

2005-09-01 Thread Shaw, Chris - Accenture
] = data ) /manual snippets Its actually on the same page as array_merge in array functions. -Original Message- From: Ahmed Abdel-Aliem [mailto:[EMAIL PROTECTED] Sent: 01 September 2005 09:43 To: php-general@lists.php.net Subject: [PHP] array merge problem

Re: [PHP] array varible problems

2005-08-14 Thread edwardspl
Sorry, I don't quit understanding the site http://www.php.net/for... So, would you mind to give me a example about it ? Thank for your help ! Jasper Bryant-Greene wrote: Dan Lowe wrote: for($i=1;$i5;$i++) This means: * Start with $i = 1 * End loop if $i is less than 5 * Increment

Re: [PHP] array varible problems

2005-08-14 Thread Jasper Bryant-Greene
[EMAIL PROTECTED] wrote: Sorry, I don't quit understanding the site http://www.php.net/for... So, would you mind to give me a example about it ? for($i=0; $i3; $i++) { print($i); } will print: 0 1 2 Basically in any expression like the following: for(expr1; expr2; expr3) {

Re: [PHP] array varible problems

2005-08-14 Thread edwardspl
Hello Jasper, Does your means : I need to rewite the source / result page as the following ? Result page: ? for($i=0;$i4;$i++) { $f.$i=$_GET['$f.$i']; } ? table tr td? echo $f0[0];?/td td? echo $f1[0];?/td td? echo $f2[0];?/td td? echo $f3[0];?/td /tr tr td? echo $f0[1];?/td td? echo

Re: [PHP] array varible problems

2005-08-14 Thread Jasper Bryant-Greene
[EMAIL PROTECTED] wrote: Hello Jasper, Does your means : I need to rewite the source / result page as the following ? [snip] Yes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] array varible problems

2005-08-13 Thread edwardspl
Dear you, Now, I want to define a set of array varible with table structure as the following: Result page: table tr td? $f1[0];?/td td? $f2[0];?/td td? $f3[0];?/td td? $f4[0];?/td /tr tr td? $f1[1];?/td td? $f2[1];?/td td? $f3[1];?/td td? $f4[1];?/td /tr tr td? $f1[2];?/td td? $f2[2];?/td td?

Re: [PHP] array varible problems

2005-08-13 Thread Dan Lowe
On Aug 13, 2005, at 8:35 AM, [EMAIL PROTECTED] wrote: table tr for($i=1;$i5;$i++) This means: * Start with $i = 1 * End loop if $i is less than 5 * Increment $i each time around So your loop is ending at the first check because $i is less than 5. You want $i 4 instead, I think. -dan

Re: [PHP] array varible problems

2005-08-13 Thread Jasper Bryant-Greene
Dan Lowe wrote: for($i=1;$i5;$i++) This means: * Start with $i = 1 * End loop if $i is less than 5 * Increment $i each time around So your loop is ending at the first check because $i is less than 5. You want $i 4 instead, I think. Umm, no, I don't think so... Your second point is

Re: [PHP] array()

2005-08-02 Thread Jochem Maas
Edward Vermillion wrote: Sebastian wrote: is it always necessary to call array() when you do something like this: mysql_query(SELECT ); while($rows .) { $data[] = $rows; } if so, why? i have a habit of never calling array() and someone told me i shouldn't do this. If that's

Re: [PHP] array()

2005-08-02 Thread Rory Browne
You're using a lot of negatives. $data = array(); // You should initialise $data to array() for various reasons: // 1: self_documentation - to anyone who reads your code will be obvious // that $data should contain an empty array // 2: security - if someone goes to //

Re: [PHP] array()

2005-08-02 Thread Jochem Maas
Rory Browne wrote: You're using a lot of negatives. nice catch on the double neg Rory :-) $data = array(); // You should initialise $data to array() for various reasons: // 1: self_documentation - to anyone who reads your code will be obvious // that $data should contain an empty

[PHP] array()

2005-08-01 Thread Sebastian
is it always necessary to call array() when you do something like this: mysql_query(SELECT ); while($rows .) { $data[] = $rows; } if so, why? i have a habit of never calling array() and someone told me i shouldn't do this. -- No virus found in this outgoing message. Checked by

Re: [PHP] array()

2005-08-01 Thread Edward Vermillion
Sebastian wrote: is it always necessary to call array() when you do something like this: mysql_query(SELECT ); while($rows .) { $data[] = $rows; } if so, why? i have a habit of never calling array() and someone told me i shouldn't do this. If that's your first use of $data then

[PHP] php array and java fold out menu

2005-07-29 Thread Gregory Machin
Hi . Please could you advise. I'm insearch of a java fold out menu that looks good, and can acept an array containg the links and link names etc from a php array ... i havent worked in java script yet so please help :-)... Many thanks -- Gregory Machin [EMAIL PROTECTED] [EMAIL PROTECTED

[PHP] array help

2005-07-14 Thread Fletcher Mattox
How does one represent a MySQL table as a two dimensional array using the column names as one of the indices? My naive attempt went something like this: while ($row = mysqli_fetch_assoc($result)) $table[] = $row; but that generated this error; Fatal error: []

Re: [PHP] array help

2005-07-14 Thread Robert Cummings
Did you bother to initialize $table as an array() or are you another lazy slob of a programmer that expects the engine to read your mind (cluttered as that may be)? Cheers, Rob. On Thu, 2005-07-14 at 18:33, Fletcher Mattox wrote: How does one represent a MySQL table as a two dimensional array

Re: [PHP] array help

2005-07-14 Thread Richard Davey
Hello Fletcher, Thursday, July 14, 2005, 11:33:36 PM, you wrote: FM while ($row = mysqli_fetch_assoc($result)) FM $table[] = $row; FM but that generated this error; FM Fatal error: [] operator not supported for strings The above WILL work providing that (1)

Re: [PHP] array help

2005-07-14 Thread Fletcher Mattox
Rob writes: Did you bother to initialize $table as an array() or are you another lazy slob of a programmer that expects the engine to read your mind (cluttered as that may be)? Bingo. You seem to have no trouble reading my mind, why can't php? :) Years of perl programming has promoted a

<    1   2   3   4   5   6   7   8   9   10   >