http://www.google.lt/#hl=lt&q=php+create+database&btnG=Google+Paie%C5%A1ka&meta=&aq=f&fp=e3b200ca80b5f29f
web dizainas | B2B sprendimai | e-komercija
--------------------------------------------
skype - naujasdizainas
www.naujasdizainas.lt
gedas rašė:
> Naudoju toki scriptuka, kuris automatiskai sukuria DB:
> <?
> $sql = "CREATE DATABASE content";
>
> $connection = @mysql_connect("localhost","root","") or die(mysql_error());
> $result = @mysql_query($sql,$connection) or die(mysql_error());
> if ($result) {$msg ="<P>Database has been created!</P>";}
> ?>
> <HTML>
> <HEAD>
> <TITLE>Create a MySQL Database</TITLE>
> </HEAD>
> <BODY><? echo "$msg"; ?>
> </BODY>
> </HTML>
>
> Taip pat noriu, kad automatiskai sukurtu lentele "users", skriptuka
> papildau tokiomis komandomis:
>
> $sql = "USE content";
> $sql = "CREATE TABLE `users` (
> `user_id` int(10) unsigned NOT NULL auto_increment,
> `email` varchar(40) NOT NULL,
> `registration_date` datetime NOT NULL,
> PRIMARY KEY (`user_id`),
> UNIQUE KEY `email` (`email`),
> KEY (`email`,`pass`)
> )";
>
> Ismeta tokia pranesima, "No database selected" ir nesukuria nei DB, nei
> lenteles. Kame cia gali buti beda? Dekoju is mintis.