Re: Help with multidimensional array setting up a mysql query..

From: Date: Tue, 15 Aug 2000 15:40:44 +0000
Subject: Re: Help with multidimensional array setting up a mysql query..
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-11828@lists.php.net to get a copy of this message
cday@beachassociates.com (Chad Day) writes: > while (list ($key2, $val) = each ($bigarray["$key1"])) { > $subquery .= "$val,"; > } > > The problem is that the statements are printing out like: > > SELECT ABEPN, CABEPN, DESCRIPTION, QUANTITY, PRICE, from abeparts where > ABEPN like PARTNUM > SELECT GUDENPN, CGUDENPN, DESCRIPTION, PRICE, from gudenparts where GUDENPN > like PARTNUM > > which is REALLY CLOSE to what I want. The problem is the last array > element, (PRICE).. it adds the comma after it, which I understand why it > does. I just don't know how to write something to say "Hey, this is the > last element in the array, so $subquery .= " $val", not $subquery .= " > $val,". Can you not just use join rather than a loop? $subquery .= join( ", ", $bigarray[$key1]); -robin -- Robin Vickery............................................... Planet-Three, 3A West Point, Warple Way, London, W3 0RG, UK Email: robin@planet-three.net Phone: +44 (0)794 670 6395

« previous php.general (#11828) next »