diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2018-09-22 14:05:19 +0200 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2018-09-22 14:05:19 +0200 |
commit | c3c4be4a4efd1404aad19797c15d2a9a6ffe29a6 (patch) | |
tree | a231ef1dc9171ae589b21ea4826bba20cba2c63d /class/class.w.app.php | |
parent | 701c4637294fc9b63d53a8eeb26d46ef94af1941 (diff) | |
download | wcms-c3c4be4a4efd1404aad19797c15d2a9a6ffe29a6.tar.gz wcms-c3c4be4a4efd1404aad19797c15d2a9a6ffe29a6.zip |
2.7 table duplicate + css edit + desktop color
Diffstat (limited to 'class/class.w.app.php')
-rw-r--r-- | class/class.w.app.php | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/class/class.w.app.php b/class/class.w.app.php index 29d3fef..82e2bef 100644 --- a/class/class.w.app.php +++ b/class/class.w.app.php @@ -409,11 +409,11 @@ class App `template` varchar(255) DEFAULT NULL )"; - $alter = "ALTER TABLE `'.$tablename.'` + $alter = "ALTER TABLE `$tablename` ADD PRIMARY KEY (`id`)"; $req = $this->bdd->query($table); - $req->closeCursor(); + $req = $this->bdd->query($alter); return 'tablecreated'; } else { @@ -423,6 +423,26 @@ class App + public function tableduplicate($dbname, $arttable, $tablename) + { + $arttable = strip_tags($arttable); + $tablename = str_clean($tablename); + if($this->tableexist($dbname, $arttable) && !$this->tableexist($dbname, $tablename)) { + $duplicate = " CREATE TABLE `$tablename` LIKE `$arttable`;"; + $alter = "ALTER TABLE `$tablename` ADD PRIMARY KEY (`id`);"; + $insert = "INSERT `$tablename` SELECT * FROM `$arttable`;"; + + + $req = $this->bdd->query($duplicate . $alter . $insert); + + return 'tableduplicated'; + } else { + return 'tablealreadyexist'; + } + } + + + // __________________________________________ M E D ________________________________________________________ |