Re: [PHP] Array Push and Keys

2003-08-29 Thread David Otton
On Fri, 29 Aug 2003 11:18:18 -0400, you wrote: >The question for anyone out there is simple - does array_push allow you to >push key=>value pairs? That is what is causing errors - nothing else, >everything else is a result of inherited systems, and other developers >crappy design. I agree with y

Re: [PHP] Array Push and Keys

2003-08-29 Thread Ernest E Vogelsinger
At 00:14 29.08.2003, Mike Morton said: [snip] > >I am trying to loop through some database results to build an array similar >to: > >Array ( >[33]=>Array ( >[usa]=>52.00 >[sa]=>553.00 >) >) > >And the problem that I am having is that a

Re: [PHP] Array Push and Keys

2003-08-29 Thread Mike Morton
The code that I ended up using was: $res=mysql_query("select distinct dealercode from transactions where dealercode!='' order by dealercode",$intranet); $count=0; while($row=mysql_fetch_array($res)) { $amt=mysql_query("select sum(amount) as total from transactions where date between '2003-04-0

Re: [PHP] Array Push and Keys

2003-08-29 Thread John W. Holmes
Ford, Mike [LSS] wrote: Having said that, I've just given you a clue: since array_push($array, $var) is equivalent to $array[] = $var, you can get the result you want by doing: $array[] = array($k, $v); (with, of course, appropriate values for $array, $k and $v substituted to suit your code!).

RE: [PHP] Array Push and Keys

2003-08-29 Thread Ford, Mike [LSS]
-Original Message- From: Mike Morton To: David Otton Look - David - I do appreciate your efforts to help - and I realize that working blind on an email list is tough, but the question is not about the structure of the code, the database, reserved words or anything else. The question for a

Re: [PHP] Array Push and Keys

2003-08-29 Thread Mike Morton
And as a follow up, from the phpbuilder list where I posted the very same question today, I think this answers the question: "I don't think its a bug. I think the problem you're having is to do with what type of argument you can give to array_push. There are two possibilities ... 1) variable 2)

Re: [PHP] Array Push and Keys

2003-08-29 Thread Mike Morton
Look - David - I do appreciate your efforts to help - and I realize that working blind on an email list is tough, but the question is not about the structure of the code, the database, reserved words or anything else. The question for anyone out there is simple - does array_push allow you to push

Re: [PHP] Array Push and Keys

2003-08-29 Thread David Otton
On Fri, 29 Aug 2003 07:54:45 -0400, you wrote: >Correct on the brackets - but not on the results still working... The code >I had in the email was just a sample - here is the real code... Ack. For anyone watching, if you have a problem please post a minimal code snippet that illustrates the prob

Re: [PHP] Array Push and Keys

2003-08-29 Thread Mike Morton
Correct on the brackets - but not on the results still working... The code I had in the email was just a sample - here is the real code... $res=mysql_query("select distinct dealercode from transactions order by dealercode",$intranet); $transactions=Array(); while($row=mysql_fetch_array($res)) {

Re: [PHP] Array Push and Keys

2003-08-29 Thread David Otton
On Thu, 28 Aug 2003 18:14:39 -0400, you wrote: >While($row=mysql_fetch_array($res) { >That *should* create the array above, but as I mentioned array_push does not >seem to be taking the keys I just get a Parse error message for the >line. (the first array_push) Ahem. Count the brackets? :)

[PHP] Array Push and Keys

2003-08-28 Thread Mike Morton
I am trying to loop through some database results to build an array similar to: Array ( [33]=>Array ( [usa]=>52.00 [sa]=>553.00 ) ) And the problem that I am having is that array_push does not want to take keys when I am using it. My Code: $transactions=Array(); While($r