Jump to content

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?
Link to comment
https://forums.phpfreaks.com/topic/12129-mysql-database-question/
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.
[!--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];
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.