Re: Function parameters and arrays

From: Date: Thu, 18 Sep 2008 16:25:10 +0000
Subject: Re: Function parameters and arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-280453@lists.php.net to get a copy of this message
Actually Stut pointed out that I was calling both dimmensions when my sorry butt should only have been referencing the second one. I had everything over expanded so I could see where the code was breaking. Thank you everyone for the help! That was fantastic! Frank ""Frank Stanovcak"" <blindspotpro@comcast.net> wrote in message news:15.76.44246.FF272D84@pb1.pair.com... >I am trying to pass a multi dimmed array as a variable parameter to a >custom function to build a query for me. Here is the basic code and what I >am getting. > > $WhereList[0][0] = 'OESalesOrder.OrderNo'; > $WhereList[0][1] = '='; > $WhereList[0][2] = '2272'; > $SQLString = SQLCall('OESalesOrder',$FieldList,$WhereList); > > I then use a foreach in the function to process it. > > $i = 0; > foreach(func_get_arg(2) as $WhereArray) { > echo $WhereArray[0][0]; > if($i == 0) { > $SQLStmt .= ' ' . $WhereArray[$i][0] . ' ' . $WhereArray[$i][1] . ' > ' . > $WhereArray[$i][2]; > $i += 1; > } else { > $SQLStmt .= ' ' . $WhereArray[$i][0] . ' ' . $WhereArray[$i][1] . ' > ' . > $WhereArray[$i][2] . ' ' . $WhereArray[$i][3]; > $i += 1; > }; > }; > > What I get when it processes is the first three letters of [0][0] > [0][0] = O > [0][1] = E > [0][2] = S > > Did I do something wrong, or is this not possible? I have done an array > processing this way before, but not multidimmed. > > Frank. >

« previous php.general (#280453) next »