Re: mysql_query - CREATE DATABASE

From: Date: Mon, 09 Feb 2009 18:17:38 +0000
Subject: Re: mysql_query - CREATE DATABASE
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-288009@lists.php.net to get a copy of this message
R B wrote: > Hello, > > When i create a mysql database with the next command: > > mysql_query("CREATE DATABASE my_db",$con) > > In the server is created the database, but usually the name is created with > a prefix. > > In this case: someuser_my_db > > How can i detect with PHP the complete name of the new database created? > > Thanks > There may be a better way, but off the top of my head, translate this to PHP: use information_schema; select SCHEMA_NAME from SCHEMATA where SCHEMA_NAME like '%_my_db'; Now of course you could have multiples there, like user_my_db and user2_my_db. Not sure about that, maybe it would be the last one in the returned records? -- Thanks! -Shawn http://www.spidean.com

« previous php.general (#288009) next »