|  | Posted by Jerry Stuckle on 09/11/07 01:13 
J. Frank Parnell wrote:> On Fri, 07 Sep 2007 21:34:22 -0400, Jerry Stuckle <jstucklex@attglobal.net>
 > wrote:
 >
 >> Jerry Stuckle wrote:
 >>> J. Frank Parnell wrote:
 >>>> On Fri, 07 Sep 2007 15:01:24 -0400, Jerry Stuckle
 >>>> <jstucklex@attglobal.net>
 >>>> wrote:
 >>>>
 >>>>> Jerry Stuckle wrote:
 >>>>>> J. Frank Parnell wrote:
 >>>>>>> On Fri, 07 Sep 2007 07:22:46 -0400, Jerry Stuckle
 >>>>>>> <jstucklex@attglobal.net>
 >>>>>>> wrote:
 >>>>>>>
 >>>>>>>> J. Frank Parnell wrote:
 >>>>>>>>> On Thu, 06 Sep 2007 21:41:27 -0400, Jerry Stuckle
 >>>>>>>>> <jstucklex@attglobal.net>
 >>>>>>>>> wrote:
 >>>>>>>>>
 >>>>>>>>>> J. Frank Parnell wrote:
 >>>>>>>>>>> Hello,
 >>>>>> reset $array1;
 >>>>>> reset $array2;
 >>>>>>
 >>>>>> for (($val1 = each($array1)) || ($val2 = each($array2)) {
 >>>>>>   if ($val1) { // false if at the end
 >>>>>>     // $val1['key'] contains the key
 >>>>>>     // $val1['value'] contains the value
 >>>>>>     echo $val1['key'] . '=>' $val1['value'];
 >>>>>>   }
 >>>>>>   else
 >>>>>>     echo ' ';
 >>>>>>   if ($val2) { // false if at the end
 >>>>>>     // $val2['key'] contains the key
 >>>>>>     // $val2['value'] contains the value
 >>>>>>     echo $val2['key'] . '=>' $val2['value'];
 >>>>>>   }
 >>>>>>   else
 >>>>>>     echo ' ';
 >>>>>> }
 >>>>>>
 >>>>>>
 >>>>> Sorry - that should be:
 >>>>>
 >>>>> for (($val1 = each($array1)) || ($val2 = each($array2))) {
 >>>>>
 >>>>> Missed an extra paren at the end.
 >>>> Thanks again for the help, however, I still get:
 >>>> Parse error: syntax error, unexpected ')', expecting ';' in
 >>>> /web/sites/asdf/asdf.com/_impexp/test.php on line 55
 >>>>
 >>>> Isnt there supposed to be 3 expressions in a FOR?  I tried with
 >>>> semicolons here
 >>>> and there, but couldnt get it.
 >>>> current code:
 >>>>  for (($val1 = each($users)) || ($val2 = each($newusers))) {
 >>>>    if ($val1) { // false if at the end
 >>>>      // $val1['key'] contains the key
 >>>>      // $val1['value'] contains the value
 >>>>      echo $val1['key'] . '=>' $val1['value'];
 >>>>    }
 >>>>    else
 >>>>      echo ' ';
 >>>>    if ($val2) { // false if at the end
 >>>>      // $val2['key'] contains the key
 >>>>      // $val2['value'] contains the value
 >>>>      echo $val2['key'] . '=>' $val2['value'];
 >>>>    }
 >>>>    else
 >>>>      echo ' ';
 >>>> }
 >>>>
 >>>>
 >>>>
 >>> Sorry - it should be a 'while' loop, not a 'for' loop.
 >>>
 >> Also, see the correction above in response to Rik's comments:
 >
 > OK, got it thanks. Everybody, Rik, Jerry, Gosha and Satya...I appreciate it.
 >
 > Now, I go to test things and of course, I forgot one big detail.  The two arrays
 > are actually multidimensional themselves:
 > $a[0] = array('a[0]key1' => 'a[0]val1', 'a[0]key2' => 'a[0]val2');
 > $a[1] = array('a[1]key1' => 'a[1]val1', 'a[1]key2' => 'a[1]val2');
 > $b[0] = array('b[0]key1' => 'b[0]val1', 'b[0]key2' => 'b[0]val2', 'b[0]key3' =>
 > 'b[0]val3');
 > $b[1] = array('b[1]key1' => 'b[1]val1', 'b[1]key2' => 'b[1]val2', 'b[1]key3' =>
 > 'b[1]val3');
 > $b[2] = array('b[2]key1' => 'b[2]val1', 'b[2]key2' => 'b[2]val2', 'b[2]key3' =>
 > 'b[2]val3');
 >
 > More like that.  $a and $b are db results (arrays).  Each element has its own
 > array of feild=>value.
 >
 > I tried a couple things, nesting those scripts inside each other, but to no
 > avail.
 >
 
 So, what is it exactly you want?
 
 --
 ==================
 Remove the "x" from my email address
 Jerry Stuckle
 JDS Computer Training Corp.
 jstucklex@attglobal.net
 ==================
 [Back to original message] |