If you are feeling lazy, or would like to build in some future proofness into your system, you can use the MySQL Desc query to get table column information and then use this information to create dynamic SQL insertion strings.
For example:
PLAIN TEXT
PHP:
$cols_query = db_query("desc table");
while($cq = mysql_fetch_assoc($cols_query)){
$cols[]=$cq;
}
foreach($cols as $c){
if(!empty($_POST[$c['Field']])){
[...]