> -----Original Message-----
> From: Becoming Digital [mailto:[EMAIL PROTECTED]
> 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: [EMAIL PROTECTED]
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