31. oktober 2007 - 16:28Der er
11 kommentarer og 1 løsning
opret ny tabel i db fra site
hejsa, er det muligt at oprette en ny tabel med en sql streng fra et site?
jeg har en tabel som indeholder et projekt med en masse rækker.
hvis man vil påbegynde et nyt projekt, kan man så oprette en ny tabel direkte fra sitet?
eksport af "projekt 1":
CREATE TABLE `reg_db` ( `id` int(11) NOT NULL auto_increment, `bygning` text NOT NULL, `etage` text NOT NULL, `rumnr` text NOT NULL, `longitude` text NOT NULL, `latitude` text NOT NULL, `furn` text NOT NULL, `type_besk` text NOT NULL, `specs` text NOT NULL, `producent` text NOT NULL, `benfarve` text NOT NULL, `model` text NOT NULL, `overflade` text NOT NULL, `traesort` text NOT NULL, `bredde` text NOT NULL, `dybde` text NOT NULL, `dyb_bredest` text NOT NULL, `dyb_small` text NOT NULL, `hoejde` text NOT NULL, `sokkel` text NOT NULL, `sidebord` text NOT NULL, `diameter` text NOT NULL, `pic` text NOT NULL, `thumb` text NOT NULL, `kommentar` text NOT NULL, `projekt` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=40 ;
kan man lave så CREATE TABLE `reg_db` bliver til CREATE TABLE `$projekt`
mysql_query("CREATE TABLE $opretdb (`id` int(11) NOT NULL auto_increment, `bygning` text NOT NULL, `etage` text NOT NULL, `rumnr` text NOT NULL, `longitude` text NOT NULL, `latitude` text NOT NULL, `furn` text NOT NULL, `type_besk` text NOT NULL, `specs` text NOT NULL, `producent` text NOT NULL, `benfarve` text NOT NULL, `model` text NOT NULL, `overflade` text NOT NULL, `traesort` text NOT NULL, `bredde` text NOT NULL, `dybde` text NOT NULL, `dyb_bredest` text NOT NULL, `dyb_small` text NOT NULL, `hoejde` text NOT NULL, `sokkel` text NOT NULL, `sidebord` text NOT NULL, `diameter` text NOT NULL, `pic` text NOT NULL, `thumb` text NOT NULL, `kommentar` text NOT NULL, `projekt` text NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=40")or die("MySQL ERROR: ".mysql_error());
giver: MySQL ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(id int(11) NOT NULL auto_increment, `bygning` text NOT NULL, `etage` text NOT N' at line 1
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.