1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Creating new Mysql database

Discussion in 'PHP' started by technoguy, Jan 21, 2007.

Thread Status:
Not open for further replies.
  1. #1
    How to create new Mysql database using php script? I am able to create new table using "create table abc" but unable to create database using

    
    $q="create database mydata";
    $re=mysql_query($q);
    
    PHP:

     
    technoguy, Jan 21, 2007 IP
  2. projectshifter

    projectshifter Peon

    Messages:
    394
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Make sure on your queries you do mysql_query($query) or die('Error: '.mysql_error()); Otherwise when you have errors such as this, you have no idea why. You probably have no made a connection to the server if that isn't working, or it already exists.
     
    projectshifter, Jan 21, 2007 IP
  3. technoguy

    technoguy Notable Member

    Messages:
    4,396
    Likes Received:
    308
    Best Answers:
    0
    Trophy Points:
    205
    #3
    Connection is ok, its showing error in query only. I have already kept or die there.

    Do you any code for it?
     
    technoguy, Jan 22, 2007 IP
  4. projectshifter

    projectshifter Peon

    Messages:
    394
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ? What error are you getting? You do have mysql_select_db() right? Not sure what "do you any code for it" means. It's simple "create database <name>".
     
    projectshifter, Jan 22, 2007 IP
  5. socabo

    socabo Guest

    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Try mysql_create_db('mydata');
     
    socabo, Jan 22, 2007 IP
Thread Status:
Not open for further replies.