Modified: trunk/htdocs/system/classes/databaseconnection.php (4639 => 4640)
--- trunk/htdocs/system/classes/databaseconnection.php 2010-11-28 00:28:26 UTC (rev 4639)
+++ trunk/htdocs/system/classes/databaseconnection.php 2010-11-28 00:29:20 UTC (rev 4640)
@@ -561,16 +561,11 @@
{
ksort( $fieldvalues );
- $query = "INSERT INTO {$table} ( ";
- $comma = '';
+ $fields = array_keys( $fieldvalues );
+ $values = array_values( $fieldvalues );
+
+ $query = "INSERT INTO {$table} ( " . implode( ', ', $fields ) . ' ) VALUES ( ' . implode( ', ', array_fill( 0, count( $values ), '?' ) ) . ' )';
- foreach ( $fieldvalues as $field => $value ) {
- $query .= $comma . $field;
- $comma = ', ';
- $values[] = $value;
- }
- $query .= ' ) VALUES ( ' . trim( str_repeat( '?,', count( $fieldvalues ) ), ',' ) . ' );';
-
// need to pass $table on to the $o singleton object;
$this->current_table = $table;