Server IP : 180.180.241.3 / Your IP : 216.73.216.127 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/AppServ/www/umedia3/inc/ |
Upload File : |
<? function get_def($dbname, $table,$isdropold="YES") { global $conn; $def=""; if ($isdropold=="YES") { $def.="DROP TABLE IF EXISTS $table;#%%\n"; } $def.="CREATE TABLE $table (\n"; $result=tmq( "SHOW FIELDS FROM $table"); while ($row=tmq_fetch_array($result)) { $def .= " `$row[Field]` $row[Type]"; if ($row["Default"] != "") $def.=" DEFAULT '$row[Default]'"; if ($row["Null"] != "YES") $def.=" NOT NULL"; if ($row[Extra] != "") $def.=" $row[Extra]"; $def.=",\n"; } $def=ereg_replace(",\n$", "", $def); $result=tmq( "SHOW KEYS FROM $table"); while ($row=tmq_fetch_array($result)) { $kname = $row[Key_name]; if (($kname != "PRIMARY") && ($row[Non_unique] == 0)) $kname="UNIQUE|$kname"; if (!isset($index[$kname])) $index[$kname]=array ( ); $index[$kname][]=$row[Column_name]; } while (list($x, $columns)=@each($index)) { $def .= ",\n"; if ($x == "PRIMARY") $def.=" PRIMARY KEY (" . implode($columns, ", ") . ")"; else if (substr($x, 0, 6) == "UNIQUE") $def.=" UNIQUE " . substr($x, 7) . " (" . implode($columns, ", ") . ")"; else $def.=" KEY $x (" . implode($columns, ", ") . ")"; } $def.="\n);#%%"; return (stripslashes($def)); } ?>