select(GesTable::qryCampos($table,$dbname),true); $key = GesTable::primaryKey($campos); $ins = "INSERT INTO ".$table."("; foreach ($campos as $c) { $ins.=$c["Field"].","; } $ins = substr($ins,0,strlen($ins)-1); // quitar ultima coma $ins.= ")". "VALUES ("; foreach ($campos as $c) { eval("\$valor = "."\$campo_"."$c[Field];"); if ($valor=="") $ins.="null,"; else if (strpos($c["Type"],"int")!==false) $ins.=$valor.","; else if (strpos($c["Type"],"decimal")!==false) $ins.=$valor.","; else // las cadenas, fechas y horas van entre '' $ins.="'".$valor."',"; } $ins = substr($ins,0,strlen($ins)-1); // quitar ultima coma $ins.= ")"; $bd->execSql($ins); $bd->cierraConexion(); $incremento = isset($increment)?"&increment=$increment":""; $orden = isset($order)?"&order=$order":""; $cabecera = isset($cabecera)?"&cabecera=$cabecera":""; $link = isset($link)?"&link=$link":""; header("Location: Table.php?table=$table&dbname=$dbname$orden$incremento$cabecera$link"); ?>