Jump to content

Archived

This topic is now archived and is closed to further replies.

KDragon

MySQL database question

Recommended Posts

I know of the functionality of some of php's built-in functions that allow you to write to a file and if the file doesn't exist it will create it. I would like to do this same thing with a database. Most people just say to use phpMyAdmin to create the databases first but this seems a little convoluted and it seems to me I should be able to just write or find a php function that can create a database if and only if it isn't already created. I could use phpMyAdmin but does anyone know of way of doing what I want to do?

Share this post


Link to post
Share on other sites
What do you need this for? I mean in any case it's much better not to have a function checking if the database exists every moment.

Share this post


Link to post
Share on other sites
[!--quoteo(post=384479:date=Jun 16 2006, 03:36 AM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 16 2006, 03:36 AM) [snapback]384479[/snapback][/div][div class=\'quotemain\'][!--quotec--]
What do you need this for? I mean in any case it's much better not to have a function checking if the database exists every moment.
[/quote]
I don't really need it. I just wondered if it could be done. I don't need it to check every moment. Just every time I have to write something to a particular database.

Share this post


Link to post
Share on other sites
The more predefined stuff you have the better. Reduces the time for processing code, if you are going to need the database, it's better to create it anyway

Share this post


Link to post
Share on other sites
[!--quoteo(post=384489:date=Jun 16 2006, 09:08 AM:name=KDragon)--][div class=\'quotetop\']QUOTE(KDragon @ Jun 16 2006, 09:08 AM) [snapback]384489[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I don't really need it. I just wondered if it could be done. I don't need it to check every moment. Just every time I have to write something to a particular database.
[/quote]

You can use a query like this i think!!

CREATE DATABASE MyNewDatabase [IF NOT EXISTS];

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.