Jump to content


Photo

MySQL database question


  • Please log in to reply
4 replies to this topic

#1 KDragon

KDragon
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 16 June 2006 - 06:23 AM

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?

#2 joquius

joquius
  • Members
  • PipPipPip
  • Advanced Member
  • 319 posts

Posted 16 June 2006 - 07:36 AM

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.
z..z..z..z..z..z..z..z..

#3 KDragon

KDragon
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 16 June 2006 - 08:08 AM

[!--quoteo(post=384479:date=Jun 16 2006, 03:36 AM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 16 2006, 03:36 AM) View Post[/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.

#4 joquius

joquius
  • Members
  • PipPipPip
  • Advanced Member
  • 319 posts

Posted 16 June 2006 - 08:20 AM

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
z..z..z..z..z..z..z..z..

#5 d_barszczak

d_barszczak
  • Members
  • PipPipPip
  • Advanced Member
  • 188 posts
  • LocationBradford - UK

Posted 16 June 2006 - 08:35 AM

[!--quoteo(post=384489:date=Jun 16 2006, 09:08 AM:name=KDragon)--][div class=\'quotetop\']QUOTE(KDragon @ Jun 16 2006, 09:08 AM) View Post[/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];

When all else fails - Try reading the manual.

Integrated IT Systems Ltd





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users