Yes, it does what I want, but perhaps not what I described. My goal was to find a way to add values to the actual query, which this does nicely. Yours, thank you very much, is even nicer. :) Edward Dudlik Becoming Digital www.becomingdigital.com ----- Original Message ----- From: "Ford, Mike [LSS]" <M.Ford@lmu.ac.uk> To: "'Becoming Digital'" <subs@becomingdigital.com>; "PHP-DB" <php-db@lists.php.net> Sent: Thursday, 29 May, 2003 08:00 Subject: RE: Multiple inserts revisited > -----Original Message----- > From: Becoming Digital [mailto:subs@becomingdigital.com] > Sent: 28 May 2003 23:38 > > My other option, as I saw it, was to loop through the items, > appending value > data to the query text with each iteration. If that seems > cryptic, here's a > basic idea of what I mean. > > <? > $query = "INSERT INTO specials VALUES (" > foreach ( $specials as $item ) { > $query = substr_replace( $query, $item.", ", strlen( $query ) ); > } > $query = substr_replace( $query, ")", strlen( $query )-2 ); > ?> > > If $specials was an array with the values spec1, spec2, and > spec3, the final > value of $query would be: > INSERT INTO specials VALUES (spec1, spec2, spec3) I'm actually slightly dubious that this query *does* do what you want, but if you've double-checked it and it does, then this is a somewhat more compact way of producing it: $query = "INSERT INTO specials VALUES (" . implode(',', $specials) . ')' Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@lmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php