in php-scripts, to insert data to database, i'm doing like this:
... $query_param = array( 'field0' => 1, 'field1' => 3, 'field2' => $var2, 'field3' => $var3, ); ...
$sql = "INSERT INTO $table (".implode(", ", array_keys($query_param)).") VALUES ('".implode("','", $query_param)."')";
how it can be done, using python (elegantly, without cycles)?
sql = "INSERT INTO %s (%s) VALUES (%s)" % (table, ','.params.keys()), ','.join(param.values()))
should do the trick.
-- -------------------------------------- Ola Natvig <[EMAIL PROTECTED]> infoSense AS / development -- http://mail.python.org/mailman/listinfo/python-list