- $tablename = $row['Name'];
- $auto_incr[$tablename] = $row['Auto_increment'];
-
- $out.="\n\n";
- // export tables
- $out.="### Structure of table `".$tablename."` ###\n\n";
-
- $out.="DROP TABLE IF EXISTS `".$tablename."`;\n\n";
- if ($no_default && ($def_pos = strpos($table_sql[$tablename], "DEFAULT CHARSET")) > 0)
- $table_sql[$tablename] = substr($table_sql[$tablename], 0, $def_pos);
- $out.=$table_sql[$tablename];
-
- // add auto_increment value
-// if ($auto_incr[$tablename])
-// $out.=" AUTO_INCREMENT=".$auto_incr[$tablename];
- $out.=" ;";
- $out.="\n\n";
-
- // export data
- if (!$error)
- {
- $out.="### Data of table `".$tablename."` ###\n";
-
- // check if field types are NULL or NOT NULL
- $res3 = db_query("SHOW COLUMNS FROM `" . $tablename . "`");
-
- $field_null = array();
- for ($j = 0; $j < db_num_rows($res3); $j++)
- {
- $row3 = db_fetch($res3);
- $field_null[] = $row3[2]=='YES' && $row3[4]===null;
- }
-
- $res2 = db_query("SELECT * FROM `" . $tablename . "`");
- $maxinsert = 0;
- $insert = '';
- for ($j = 0; $j < db_num_rows($res2); $j++)
+ if (!empty($row['Engine'])) { //don't export views like tables
+ $tablename = $row['Name'];
+ $auto_incr[$tablename] = $row['Auto_increment'];
+
+ $out.="\n\n";
+ // export tables
+ $out.="### Structure of table `".$tablename."` ###\n\n";
+
+ $out.="DROP TABLE IF EXISTS `".$tablename."`;\n\n";
+ $out.=$table_sql[$tablename];
+
+ $out.=" ;";
+ $out.="\n\n";
+
+ // export data
+ if (!$error)