Re: [PHP] arrays() current() next() who to use

2004-08-19 Thread Curt Zirzow
* Thus wrote Vern: I'm setting up an array based on recordset that does a loop as follows: do { //SET ARRAYS $z['username'][$k] = $row_rsUSERIDID['uname']; $z['distance'][$k++] = $totaldist; } while ($row_rsUSERIDID = mysql_fetch_assoc($rsUSERIDID)); ... How can I now

Re: [PHP] arrays() current() next() who to use

2004-08-19 Thread Vern
Well, this is the hard way to do things, and very inefficient but: foreach(array_slice($z['distance'], $start, 10) { //... } If you think there's a better way of doing it I would like to hear it. However this is resulting in an Parse error on the foreach line:

Re: [PHP] arrays() current() next() who to use

2004-08-19 Thread Michal Migurski
If you think there's a better way of doing it I would like to hear it. However this is resulting in an Parse error on the foreach line: foreach(array_slice($z['distance'], $start, 10)) { $newuser = $z['user'][$k]; echo $newuser . - . $v . br; } foreach needs an as, probably

Re: [PHP] html form elements as php arrays

2004-05-07 Thread John Nichel
Matthew Oatham wrote: Hi, I am retrieving data from a database and displaying results on a html so the user can edit them, I am sending the html form back to the server as an array, i.e on my html for I might have 10 name fields so in the html code all name fields are named name[] then I can

[PHP] html form elements as php arrays

2004-05-06 Thread Matthew Oatham
Hi, I am retrieving data from a database and displaying results on a html so the user can edit them, I am sending the html form back to the server as an array, i.e on my html for I might have 10 name fields so in the html code all name fields are named name[] then I can iterate through the

Re: [PHP] html form elements as php arrays

2004-05-06 Thread John Nichel
Matthew Oatham wrote: Hi, I am retrieving data from a database and displaying results on a html so the user can edit them, I am sending the html form back to the server as an array, i.e on my html for I might have 10 name fields so in the html code all name fields are named name[] then I can

[PHP] Arrays Keys?

2004-03-24 Thread John Taylor-Johnston
Am I doing this right? Is there a better way? Am I doing this key thing right? I'm doing the language thing. I have no extra plugins or rpms to help do this properly. So I need advice. Is this going to work? I'm trying to make sense of http://www.php.net/manual/en/language.types.array.php $date

[PHP] arrays, loops, vars and props

2004-03-10 Thread Jason Davidson
Hey, would anyone know offhand, if its faster to create a temp array, fill it via loop, and then set a class property to that array, or to simply fill the class property via loop.. to clearify. would the following example be faster or slower had i simply done $this-myArray[$i] = $i; class

RE: [PHP] arrays, loops, vars and props

2004-03-10 Thread Chris W. Parker
Jason Davidson mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 12:25 AM said: would the following example be faster or slower had i simply done $this-myArray[$i] = $i; class MyClass { var $myArray = array(); function MyClass() { $myTempArray = array();

Re: [PHP] arrays, loops, vars and props

2004-03-10 Thread Luis Mirabal
i would do it this way function MyClass() { $this-myArray = range(0, 99); } luis. Chris W. Parker [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] Jason Davidson mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 12:25 AM said: would the following example be faster

RE: [PHP] arrays, loops, vars and props

2004-03-10 Thread Michal Migurski
here's how i would do it (coding styles aside): function MyClass() { $limit = 100; $i = -1; while(++$i $limit) { $this-myArray[] = $i; } } Don't forget poor old range: $this-myArray = range(0, 99);

RE: [PHP] arrays, loops, vars and props

2004-03-10 Thread Chris W. Parker
Luis Mirabal mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 12:30 PM said: i would do it this way function MyClass() { $this-myArray = range(0, 99); } guys (luis), guys (mike), let's not try to one-up each other... ... ... but i would take it a step further. :P function

RE: [PHP] arrays, loops, vars and props

2004-03-10 Thread Jason Davidson
Im fully aware of diffrent ways of doing it, my question is, in the 2 ways i mentioned, which is more efficient. Ill take the question to the internals list. Thanks for your responses. Jason Chris W. Parker [EMAIL PROTECTED] wrote: Luis Mirabal mailto:[EMAIL PROTECTED] on Wednesday,

[PHP] Arrays as session variables

2004-02-27 Thread news.php.net
OK gurus, I'm trying to create a page that allows me to create a table in my MSSQL database. I'm accepting the field info one by one in a form using a PHP_SELF action. This information is supposed to be collected in an array that's to be stored as a session variable for semi-permanance, until

[PHP] arrays and sessions

2004-02-27 Thread Kermit Short
Uh, sorry, I'm Kermit, not news.php.net OK gurus, I'm trying to create a page that allows me to create a table in my MSSQL database. I'm accepting the field info one by one in a form using a PHP_SELF action. This information is supposed to be collected in an array that's to be stored as a

RE: [PHP] arrays and sessions

2004-02-27 Thread Chris W. Parker
Kermit Short mailto:[EMAIL PROTECTED] on Friday, February 27, 2004 1:47 PM said: A second form will contain an action that sends the sql code for creating the table to the database server, and viola, I've got myself a new table. i prefer the violin, but viola's are cool too. ;) If

Re: [PHP] arrays and sessions

2004-02-27 Thread Kermit Short
its current contents, I get index not defined errors on my for loop indices (?!). The second problem is, when I try to use the print_r function to display my array, it only displays one set of data. This might be because I'm trying to do a C++ type 2 dimensional array concept when PHP arrays

RE: [PHP] arrays and sessions

2004-02-27 Thread Chris W. Parker
Kermit Short mailto:[EMAIL PROTECTED] on Friday, February 27, 2004 2:10 PM said: I've got some code and it simply isn't working. I thought it might be because each time the form submits data, the array I'm storing information in is being re-initialized. If this is the case, I don't have

Re: [PHP] arrays and sessions

2004-02-27 Thread Justin Patrin
First of all, make sure you're doing session_start() before reading/writing any session data and before you do any output. Second, You likely need to just do something like this: session_start(); if(post data) { $_SESSION['formArray'][] = $_POST; } This will save each POST array as-is in the

[PHP] Arrays and performance

2003-11-18 Thread Kim Steinhaug
Something Ive wondered about as I started working with XML. Importing huge XML files, and converting theese to arrays works indeed very well. But I am wondering if there are any limits to how many arrays the PHP can handle when performance is accounted for. Say I create an array from a XML with

Re: [PHP] Arrays and performance

2003-11-18 Thread Raditha Dissanayake
Hi, I belive PHP should be able to handle it but it's a bad idea. The reason being your app will not scale. Because if you script consumes 2mb of memory on average, 100 users accesing it at the same time will be 200Mb. Of course if you expect only a small number of users it does not matter.

RE: [PHP] Arrays and performance

2003-11-18 Thread Pablo Gosse
Raditha Dissanayake wrote: [snip]The biggest XML job i have handled with PHP is parsing the ODP RDF dump which is around 700MB. Obviously arrays are out of the question in such a scenario, even though only one user will be accessing the script At a given moment. the ODP dump has a couple of

Re: [PHP] Arrays and performance

2003-11-18 Thread Raditha Dissanayake
hi, In fact i had to handle the ODP dump on two occaisions the first time the results went into a mysql db, the second time it went into a series of files. On both occaisions i used SAX parsers. DOM would just roll over and die with this much of data. I placed code in the end element handler

Re: [PHP] Arrays and performance

2003-11-18 Thread Kim Steinhaug
Thanks for your reply! Im going to use this for a backup system for our webstore system, where some of our customers have *alot* of products. Given the structure of the database with categories and images 5000 unique products quickly gives 3x = 15000 arrays. But again, how often would the client

[PHP] arrays and php

2003-09-30 Thread Angelo Zanetti
hi I have a table with rows and each row contains a checkbox ( array) and a record. TD of the checkbox: echo(td width=15 bgcolor=#9FD9FFinput type=checkbox name=chkR[] value=. $chkSessionF[$i] ./td); as you can see the array of checkboxes is called chkR. When the user clicks a submit button it

RE: [PHP] arrays and php

2003-09-30 Thread Chris W. Parker
Angelo Zanetti mailto:[EMAIL PROTECTED] on Tuesday, September 30, 2003 5:43 AM said: hi I have a table with rows and each row contains a checkbox ( array) and a record. TD of the checkbox: echo(td width=15 bgcolor=#9FD9FFinput type=checkbox name=chkR[] value=. $chkSessionF[$i] ./td);

Re: [PHP] arrays and php

2003-09-30 Thread Jason Wong
On Wednesday 01 October 2003 00:10, Chris W. Parker wrote: [snip] If you're not sure what a value is use print_r() to determine it. echo pre; print_r($chk); echo /pre; Quick side note on the above code: You cannot write it like: echo pre.print_r($chk)./pre; It will not work. You

RE: [PHP] arrays and php

2003-09-30 Thread Chris W. Parker
Jason Wong mailto:[EMAIL PROTECTED] on Tuesday, September 30, 2003 11:06 AM said: echo pre.print_r($chk)./pre; It will not work. You can do this though: echo pre, print_r($chk), /pre; Well heck, that makes things easier! What's the difference between using , or . for

Re: [PHP] arrays and php

2003-09-30 Thread Jason Wong
On Wednesday 01 October 2003 02:14, Chris W. Parker wrote: Jason Wong mailto:[EMAIL PROTECTED] on Tuesday, September 30, 2003 11:06 AM said: echo pre.print_r($chk)./pre; It will not work. Actually, the above *does* work! -- Jason Wong - Gremlins Associates - www.gremlins.biz Open

Re: [PHP] arrays and php

2003-09-30 Thread CPT John W. Holmes
From: Chris W. Parker [EMAIL PROTECTED] echo pre.print_r($chk)./pre; It will not work. You can do this though: echo pre, print_r($chk), /pre; Well heck, that makes things easier! What's the difference between using , or . for concatenation? (I thought they were the same.) Using a

Re: [PHP] arrays and php

2003-09-30 Thread CPT John W. Holmes
From: Jason Wong [EMAIL PROTECTED] On Wednesday 01 October 2003 02:14, Chris W. Parker wrote: Jason Wong mailto:[EMAIL PROTECTED] on Tuesday, September 30, 2003 11:06 AM said: echo pre.print_r($chk)./pre; It will not work. Actually, the above *does* work! It depends on how

RE: [PHP] arrays and php

2003-09-30 Thread Chris W. Parker
Jason Wong mailto:[EMAIL PROTECTED] on Tuesday, September 30, 2003 11:27 AM said: echo pre.print_r($chk)./pre; It will not work. Actually, the above *does* work! Not for me. (Although we may be testing different things.) ? $pageTitle = Checkout Step One; echo

RE: [PHP] arrays and php

2003-09-30 Thread Chris W. Parker
CPT John W. Holmes mailto:[EMAIL PROTECTED] on Tuesday, September 30, 2003 11:32 AM said: Note that print_r() will (by default) return a 1 (TRUE) upon success, so you end up with a 1 being printed at the end of your data. [snip] That answers it! c. -- PHP General Mailing List

RE: [PHP] arrays and php

2003-09-30 Thread Chris Shiflett
--- Chris W. Parker [EMAIL PROTECTED] wrote: What's the difference between using , or . for concatenation? (I thought they were the same.) The comma isn't concatenation; echo can take multiple arguments. I've heard statements about passing multiple arguments to echo being faster than using

Re: [PHP] arrays and php

2003-09-30 Thread CPT John W. Holmes
From: Chris W. Parker [EMAIL PROTECTED] CPT John W. Holmes mailto:[EMAIL PROTECTED] on Tuesday, September 30, 2003 11:32 AM said: Note that print_r() will (by default) return a 1 (TRUE) upon success, so you end up with a 1 being printed at the end of your data. [snip] That answers

RE: [PHP] arrays and php

2003-09-30 Thread Chris W. Parker
Chris Shiflett mailto:[EMAIL PROTECTED] on Tuesday, September 30, 2003 11:39 AM said: The comma isn't concatenation; echo can take multiple arguments. Oh ok, I get it. I've heard statements about passing multiple arguments to echo being faster than using concatenation, but every

Re: [PHP] arrays and php

2003-09-30 Thread Jason Wong
On Wednesday 01 October 2003 02:32, Chris W. Parker wrote: Jason Wong mailto:[EMAIL PROTECTED] on Tuesday, September 30, 2003 11:27 AM said: echo pre.print_r($chk)./pre; It will not work. Actually, the above *does* work! Not for me. (Although we may be testing different things.)

Re: [PHP] arrays and php

2003-09-30 Thread Eugene Lee
On Tue, Sep 30, 2003 at 09:10:44AM -0700, Chris W. Parker wrote: : : Angelo Zanetti mailto:[EMAIL PROTECTED] : on Tuesday, September 30, 2003 5:43 AM said: : : hi I have a table with rows and each row contains a checkbox ( array) : and a record. TD of the checkbox: : echo(td width=15

RE: [PHP] arrays and php

2003-09-30 Thread Chris W. Parker
Eugene Lee mailto:[EMAIL PROTECTED] on Tuesday, September 30, 2003 2:12 PM said: A heredoc is more readable: echo HTMLTAG td width=15 bgcolor=#9FD9FFinput type=checkbox name=chkR[] value={$chkSessionF[$i]}/td HTMLTAG; Yeah, but I don't like those. :P chris. -- PHP General Mailing

[PHP] Arrays and Alphabetical order

2003-07-22 Thread Don Mc Nair
Hi folks I am trying to print out a table of elements in alphabetical order. I have an SQL query which sorts out the data in order and am using 'while ($info =(mysql_fetch_row...etc)) to read the data array. I need it to echo out a table with all the A's first, then a blank line, then all the

Re: [PHP] Arrays and Alphabetical order

2003-07-22 Thread David Nicholson
Hello, This is a reply to an e-mail that you wrote on Tue, 22 Jul 2003 at 17:40, lines prefixed by '' were originally written by you. I need it to echo out a table with all the A's first, then a blank line, then all the B's, a blank line and so on. I could write 26 different queries, one for

Re: [PHP] Arrays and Alphabetical order

2003-07-22 Thread Liam Gibbs
I need it to echo out a table with all the A's first, then a blank line, then all the B's, a blank line and so on. I could write 26 different queries, one for each letter of the alphabet, but surely there is a tidier way. Do a query, sorting by the field you need alphabetized. Then do this (and

Re: [PHP] Arrays and Alphabetical order

2003-07-22 Thread Evan Nemerson
/* UNTESTED - and prolly could be more efficient */ $c = $d = ''; natsort($info); foreach ( $info as $i ) { $d = substr($i, 0, 1); if ( $d != $c ) echo \n; echo $i; $c = $d; } On Tuesday 22 July 2003 09:40 am, Don Mc Nair wrote: Hi folks I am

[PHP] php arrays into flash

2003-07-07 Thread Jim McNeely
I know a lot more about php than about flash (which is probably sad) but does anyone know how to take info in an array and pass it into an array in flash? I think they have arrays, but the only thing I can seem to find in flash to get info from php is the loadvariable actionscript step. I

Re: [PHP] php arrays into flash

2003-07-07 Thread Jim Lucas
PROTECTED] Sent: Monday, July 07, 2003 4:29 PM Subject: [PHP] php arrays into flash I know a lot more about php than about flash (which is probably sad) but does anyone know how to take info in an array and pass it into an array in flash? I think they have arrays, but the only thing I can seem

Re: [PHP] php arrays into flash

2003-07-07 Thread Miles Thompson
Jim, The key words are implode on the PHP side and split on the Flash side. Here's an example: The data is returned from PHP like so, after doing the connect, select, etc. to produce an array of 7 dates for back issues ... no claim that this is optimal code. if( $result mysql_num_rows(

Re: [PHP] php arrays into flash

2003-07-07 Thread Pascal Polleunus
Jim McNeely wrote: I know a lot more about php than about flash (which is probably sad) but does anyone know how to take info in an array and pass it into an array in flash? I think they have arrays, but the only thing I can seem to find in flash to get info from php is the loadvariable

RE: [PHP] php arrays into flash

2003-07-07 Thread Ralph
Here is a site you might want to look at: http://polar-lights.com/en/ -Original Message- From: Jim McNeely [mailto:[EMAIL PROTECTED] Sent: Monday, July 07, 2003 4:29 PM To: [EMAIL PROTECTED] Subject: [PHP] php arrays into flash I know a lot more about php than about flash (which

[PHP] Arrays

2003-03-16 Thread John Taylor-Johnston
I thought I understood this example: http://www.php.net/manual/en/ref.array.php ?php $var = array( 'name' = array( 'first' = 'Caleb', 'last' = 'Maclennan' ) ); echo My first name is {$var['name']['first']}!; ? I can do that. But, my array looks

RE: [PHP] Arrays

2003-03-16 Thread John W. Holmes
$var = array ( 'AN' = array ( 'Description' = 'Accession Number: (AN)', 'ReferenceURL' = 'AN__Accession_Number.jsp', ), 'AU' = array ( 'Description' = 'Author(s): (AU)',

Re: [PHP] Arrays

2003-03-16 Thread John Taylor-Johnston
Thanks! John W. Holmes wrote: $var = array ( 'AN' = array ( 'Description' = 'Accession Number: (AN)', 'ReferenceURL' = 'AN__Accession_Number.jsp', ), 'AU' = array ( 'Description' =

[PHP] MySQL and PHP arrays

2003-03-10 Thread {R}ichard Ashton
Is there a generally recommended way of storing an array created by PHP in a MySQL database field ? What type of field should it be, and how do you get the whole array back in one go without reconstructing it row by row, if that is possible? {R} -- PHP General Mailing List

Re: [PHP] MySQL and PHP arrays

2003-03-10 Thread Jason Wong
On Monday 10 March 2003 22:30, {R}ichard Ashton wrote: Is there a generally recommended way of storing an array created by PHP in a MySQL database field ? serialize() and unserialize(). What type of field should it be, and how do you get the whole array back in one go without reconstructing

RE: [PHP] MySQL and PHP arrays

2003-03-10 Thread Messay W Asfaw
Serializing it would be the best way: seralize($myArray) then you can get the array back using unseralize($serializedarray) -Original Message- From: {R}ichard Ashton [mailto:[EMAIL PROTECTED] Sent: 10 March 2003 14:31 To: [EMAIL PROTECTED] Subject: [PHP] MySQL and PHP arrays

Re: [PHP] MySQL and PHP arrays

2003-03-10 Thread {R}ichard Ashton
On Mon, 10 Mar 2003 22:34:44 +0800, Jason Wong wrote: On Monday 10 March 2003 22:30, {R}ichard Ashton wrote: Is there a generally recommended way of storing an array created by PHP in a MySQL database field ? serialize() and unserialize(). What type of field should it be, and how do you get

Re: [PHP] MySQL and PHP arrays

2003-03-10 Thread Mike Mannakee
You get at the data through $array = mysql_result($result,0,0); Mike {R}Ichard Ashton [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Mon, 10 Mar 2003 22:34:44 +0800, Jason Wong wrote: On Monday 10 March 2003 22:30, {R}ichard Ashton wrote: Is there a generally recommended way

RE: [PHP] MySQL and PHP arrays

2003-03-10 Thread Van Andel, Robbert
:[EMAIL PROTECTED] Sent: Monday, March 10, 2003 8:45 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] MySQL and PHP arrays You get at the data through $array = mysql_result($result,0,0); Mike {R}Ichard Ashton [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Mon, 10 Mar 2003 22:34:44

[PHP] Arrays and MySQL

2003-03-02 Thread Beauford.2002
Hi, I have an array which I am trying to total but having some problems. Any help is appreciated. Example: This is a hockey team and there are 20 players - I am selecting the goals, assists, and points from each player and then want to have a grand total of all goals, assists, and points.

Re: [PHP] Arrays and MySQL

2003-03-02 Thread Marek Kilimajer
Cannot you just make MaSQL count it? $query = select sum(goals), sum(assists), sum(points) from roster; Beauford.2002 wrote: Hi, I have an array which I am trying to total but having some problems. Any help is appreciated. Example: This is a hockey team and there are 20 players - I am

Re: [PHP] Arrays and MySQL

2003-03-02 Thread Beauford.2002
[EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Sunday, March 02, 2003 11:10 AM Subject: Re: [PHP] Arrays and MySQL Cannot you just make MaSQL count it? $query = select sum(goals), sum(assists), sum(points) from roster; Beauford.2002 wrote: Hi

Re: [PHP] Arrays and MySQL

2003-03-02 Thread Jason Wong
On Sunday 02 March 2003 23:34, Beauford.2002 wrote: Hi, I have an array which I am trying to total but having some problems. Any help is appreciated. Example: This is a hockey team and there are 20 players - I am selecting the goals, assists, and points from each player and then want to

Re: [PHP] Arrays and MySQL

2003-03-02 Thread Leo Spalteholz
On March 2, 2003 01:53 pm, Jason Wong wrote: On Sunday 02 March 2003 23:34, Beauford.2002 wrote: Hi, I have an array which I am trying to total but having some problems. Any help is appreciated. Example: This is a hockey team and there are 20 players - I am selecting the goals,

Re: [PHP] Arrays and MySQL

2003-03-02 Thread Beauford.2002
be appreciated. From below - $totals[0][4] through $totals[19][4] , $totals[0][5] through $totals[19][5], etc. - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, March 02, 2003 4:53 PM Subject: Re: [PHP] Arrays and MySQL On Sunday 02 March 2003 23:34

[PHP] arrays;session variable; empty variable

2003-02-03 Thread André Rosendaal
Hi, I have spend several hours on the following issue, and I can't figure out what I am doing wrong. Consider the next function: function CreateFileForRealPlayer () { global $playlist; $filename = $playlist[0]['url']; header(Content-Type: audio/x-pn-realaudio;); echo ($filename); }

[PHP] Arrays of strings from regex

2002-12-31 Thread David Pratt
Am working through document to collect pieces that match and then insert them into an array so they can be used to construct another file. Looking in my doc for lines like this: {\*\cs43 \additive \sbasedon10 db_edition;} {\*\cs44 \additive \sbasedon10 db_editor;} {\*\cs45 \additive \sbasedon10

Re: [PHP] Arrays of strings from regex

2002-12-31 Thread Marek Kilimajer
David Pratt wrote: Am working through document to collect pieces that match and then insert them into an array so they can be used to construct another file. Looking in my doc for lines like this: {\*\cs43 \additive \sbasedon10 db_edition;} {\*\cs44 \additive \sbasedon10 db_editor;}

[PHP] *arrays/evaluating - ! urgent !

2002-12-17 Thread Alexey Lysenkov
Hello, another newbie here. Here is a loop: for($f=0;$fcount($frage5);$f++){ $ff = $f+1; echo(tr\n); echo(td align=\right\ valign=\top\$frage5[$f]/td\n); for($h=0;$hcount($hersteller);$h++){ $hh = $h+1; $varName = q5_.$ff._.$hh; echo(td align=\center\

Re: [PHP] *arrays/evaluating - ! urgent !

2002-12-17 Thread Wico de Leeuw
Hiya, I couldn't read you code really (i think you gotta look into it, eval is evil and really not nessacery here) I suggest you look at this (piece) of code: form action=?=$_SERVER['PHP_SELF']? method=post input type=text name=text value=?=@$_REQUEST['text']?br / select

[PHP] arrays

2002-11-05 Thread Edward Peloke
Ok, very basic question, how do I am going through a loop 5 times, each time, I want to store a value into an array, do I simply set the value of $picture=array($mypics); and each time it loops it will take the current value of $picture and then I can get out each value by $mypics[0],

Re: [PHP] arrays

2002-11-05 Thread Rick Emery
] To: [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 12:44 PM Subject: [PHP] arrays Ok, very basic question, how do I am going through a loop 5 times, each time, I want to store a value into an array, do I simply set the value of $picture=array($mypics); and each time it loops it will take

Re: [PHP] arrays

2002-11-05 Thread Khalid El-Kary
hi, the function array is for making a new array. Observe this code and you will get the point (assuming that you won't to loop for five times) $myarr= array() for ($i=0;$i=5;$i++) { $myarr[$i]=$i; } //you can then get the values of the array echo $myarr[0]; echo $myarr[1]; //and like that

[PHP] Arrays misbehaving!

2002-08-30 Thread Cameron Thorne
Can anyone explain why the following code operates the way it does in my comments? ?php $test = array ( 'a' = 'A', 'b' = 'B', 'c' = 'C'); if (array_key_exists(2, $test)) echo It works by key number!; // Does not work. if (array_key_exists('c', $test)) echo It works by key name!; // Works.

Re: [PHP] Arrays misbehaving!

2002-08-30 Thread Chris Wesley
On Fri, 30 Aug 2002, Cameron Thorne wrote: Can anyone explain why the following code operates the way it does in my comments? Sure. ?php $test = array ( 'a' = 'A', 'b' = 'B', 'c' = 'C'); An associative array, $test. if (array_key_exists(2, $test)) echo It works by key number!; //

Re: [PHP] Arrays misbehaving!

2002-08-30 Thread Cameron Thorne
That does help, yes. So basically there is no way to access associative arrays using numerical indices? I was hoping I could access by either name OR number, but apparently not. Thanks! -- Cameron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Arrays misbehaving!

2002-08-30 Thread Chris Wesley
On Fri, 30 Aug 2002, Cameron Thorne wrote: I was hoping I could access by either name OR number, but apparently not. Just for kicks ... here's something pretty ugly (I'd never use it), but neat if you're interested (or somehow really have your heart set on using integers). There are probably

[PHP] Arrays within arrays question

2002-08-28 Thread Jean-Christian Imbeault
I have the following loop to insert data into an array: while ($data = pg_fetch_object($res)) { $aProds[] = array('id' = $data-prod_id, 'quantity' = $data-quantity); } But when I print this out using print_r I get the following: Array ( [0] = Array ( [0] =

Re: [PHP] Arrays within arrays question

2002-08-28 Thread Justin French
Okay, it may be the end of a long day here, but I can't tell the difference between the two arrays you posted! Justin on 28/08/02 5:31 PM, Jean-Christian Imbeault ([EMAIL PROTECTED]) wrote: I have the following loop to insert data into an array: while ($data = pg_fetch_object($res)) {

Re: [PHP] Arrays within arrays question

2002-08-28 Thread Jean-Christian Imbeault
Justin French wrote: Okay, it may be the end of a long day here, but I can't tell the difference between the two arrays you posted! One array contains only one element. That one element contains two elements, each and array with two elements. The other array contains two elements, each

Re: [PHP] Arrays within arrays question

2002-08-28 Thread Jason Wong
On Wednesday 28 August 2002 15:31, Jean-Christian Imbeault wrote: I have the following loop to insert data into an array: while ($data = pg_fetch_object($res)) { $aProds[] = array('id' = $data-prod_id, 'quantity' = $data-quantity); } But when I print this out using print_r I get

Re: [PHP] Arrays within arrays question

2002-08-28 Thread Jean-Christian Imbeault
Jason Wong wrote: If $aProds can contain more than 1 item then what you're doing now is correct. Thanks. The problem was that I was doing this: $return[] = get_array_of_prods(); the [] was creating the extra array level ... The problem I now face is that foreach keeps crapping out if I

Re: [PHP] Arrays within arrays question

2002-08-28 Thread Brent Baisley
I always put an if(is_array($var)) to check if an array was actually return. On Wednesday, August 28, 2002, at 04:49 AM, Jean-Christian Imbeault wrote: Jason Wong wrote: If $aProds can contain more than 1 item then what you're doing now is correct. Thanks. The problem was that I was

[PHP] Arrays and Regs

2002-07-18 Thread Martin Clifford
Howdy, Just a performance question, if anyone knows for sure. Within a large array, would using numerical indices be quicker than associative? I'm talking about a *noticeable* difference in performance, here. Also, on Regular Expression replacements: $text = eregi_replace(([abc]+), span

Re: [PHP] Arrays and Regs

2002-07-18 Thread Analysis Solutions
Martin: On Thu, Jul 18, 2002 at 03:55:13PM -0400, Martin Clifford wrote: Just a performance question, if anyone knows for sure. Within a large array, would using numerical indices be quicker than associative? I'm talking about a *noticeable* difference in performance, here. The

[PHP] [arrays] reading from a form.

2002-06-13 Thread Àlex Camps
I have a example.html --- script function add() { var res=0; for(x=0;x3;x++)res=res+parseFloat(example.text[x].value); example.result.value=res; } /script html form name=example action=show.php input type=text name=text value=1br input type=text name=text

Re: [PHP] [arrays] reading from a form.

2002-06-13 Thread Stuart Dallas
On Thursday, June 13, 2002 at 6:38:10 PM, you wrote: I have a example.html --- script function add() { var res=0; for(x=0;x3;x++)res=res+parseFloat(example.text[x].value); example.result.value=res; } /script html form name=example action=show.php input

RE: [PHP] Arrays

2002-06-11 Thread Lazor, Ed
free to ask questions, but try to research this and see how much you can figure out on your own first =) -Ed -Original Message- From: Daniel Broome [mailto:[EMAIL PROTECTED]] Sent: Monday, June 10, 2002 4:08 PM To: Lazor, Ed Subject: Re: [PHP] Arrays I dont know how to explane

[PHP] Arrays

2002-06-10 Thread Dan
I'm trying to get my head around arrays and how to munipulate them. what I need to do is add html around the arrays eg. lia href='.$link(0).'.$name./a/li; I have my head around that but I the number of lines the I need to create is going to change so I need the script to repeat untill all the

RE: [PHP] Arrays

2002-06-10 Thread Lazor, Ed
: [PHP] Arrays I'm trying to get my head around arrays and how to munipulate them. what I need to do is add html around the arrays eg. lia href='.$link(0).'.$name./a/li; I have my head around that but I the number of lines the I need to create is going to change so I need the script to repeat

[PHP] Arrays: Please help before I go insane?

2002-06-06 Thread Chris Boget
To see what I'm working with, go here: http://www.melancholy.org/test_tree.php You may want to copy the source and the (mySQL) db structure and set it up on your system there to test it out. Though, if you don't want to do that, I show the output at the very bottom of the page. One note: I

Re: [PHP] Arrays: Please help before I go insane?

2002-06-06 Thread Chris Boget
Now, what I'm trying to do is build a tree based on the data in the DB. It's working relatively ok if I uncomment the code that is on line 48 and comment out line 49. However, what I really want to do is build a fully associative array doing this and now** an array that has string keys

RE: [PHP] Arrays: Please help before I go insane?

2002-06-06 Thread Scott Hurring
Try: $ary[this] = array(that = 1); --- Scott Hurring Systems Programmer EAC Corporation [EMAIL PROTECTED] Voice: 201-462-2149 Fax: 201-288-1515 -Original Message- From: Chris Boget [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 06, 2002 1:48 PM To: PHP General Subject: Re: [PHP

Re: [PHP] Arrays: Please help before I go insane?

2002-06-06 Thread Chris Boget
Try: $ary[this] = array(that = 1); That works great until this has 2 children. The second child overwrites the first. :( Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Arrays: Please help before I go insane?

2002-06-06 Thread Scott Hurring
Systems Programmer EAC Corporation [EMAIL PROTECTED] Voice: 201-462-2149 Fax: 201-288-1515 -Original Message- From: Chris Boget [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 06, 2002 3:43 PM To: Scott Hurring Cc: PHP General Subject: Re: [PHP] Arrays: Please help before I go insane

[PHP] Possible bug? (was Re: [PHP] Arrays: Please help before I go insane?)

2002-06-06 Thread Chris Boget
In that case, split it up into two-steps, to only init the array if you need to i'm not really sure how the rest of your code is -- you could probably do this a nicer way, but this will work: if (!is_array($ary[this])) $ary[this] = array(); $ary[this][that] = 1; This is all well and

[PHP] RE: Possible bug? (was Re: [PHP] Arrays: Please help before I go insane?)

2002-06-06 Thread Scott Hurring
4:43 PM To: Scott Hurring; Php-General (E-mail) Subject: Possible bug? (was Re: [PHP] Arrays: Please help before I go insane?) In that case, split it up into two-steps, to only init the array if you need to i'm not really sure how the rest of your code is -- you could probably do

[PHP] arrays and same index

2002-05-30 Thread Victor Spång Arthursson
Hi! I want to create an array that looks like follows: $array[untitled_1.jpg][] = 0 $array[untitled_1.jpg][] = 3 $array[untitled_1.jpg][] = 4 $array[untitled_2.jpg][] = 0 $array[untitled_3.jpg][] = 1 What I'm thinking about is accessing all untitled_1.jpg values by doing the following:

RE: [PHP] arrays and same index

2002-05-30 Thread Cal Evans
Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Victor Spang Arthursson [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 8:37 AM To: [EMAIL PROTECTED] Subject: [PHP] arrays and same index Hi! I want to create an array that looks like follows: $array

Re: [PHP] arrays and same index

2002-05-30 Thread Stuart Dallas
Victor Spång Arthursson [EMAIL PROTECTED] wrote: I want to create an array that looks like follows: $array[untitled_1.jpg][] = 0 $array[untitled_1.jpg][] = 3 $array[untitled_1.jpg][] = 4 $array[untitled_2.jpg][] = 0 $array[untitled_3.jpg][] = 1 What I'm thinking about is accessing all

Re: [PHP] arrays and same index

2002-05-30 Thread Ed Gorski
Well what exactly are you trying to do? You can't name an index of an array the same thing and expect different values ed At 03:36 PM 5/30/2002 +0200, Victor Spång Arthursson wrote: Hi! I want to create an array that looks like follows: $array[untitled_1.jpg][] = 0

[PHP] arrays

2002-05-26 Thread Michael Hall
A couple of simple ones here ... the usual references don't appear to give a straightforward answer on these: Can arrays be passed to functions just like a simple variable? Can arrays be passed as values in hidden form fields just like a simple variable? I've been playing around with these

<    1   2   3   >