SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Guru kili's Avatar
    Join Date
    Jan 2004
    Location
    Damn I need a Crap
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    cant create database

    Hi guys I have access to control panel to create MYSQL database's but I'm trying to create it via php script. I hit the following error each time I run the script

    Fatal error: Call to undefined function: mysql_create_db() in /my directory/structure/script_11_1.php on line 14


    Heres the script
    PHP Code:
    <?php
    // Set the variables for the database access:
    $Host "localhost";
    $User "myname";
    $Password "mypassword";
    $DBName "newdatabase";
    $Link mysql_connect ($Host$User$Password);
    if (
    mysql_create_db ($DBName$Link)) {
    print (
    "The database, $DBName, was successfully created!<BR>\n");
    } else {
    print (
    "The database, $DBName, could not be created!<BR>\n");

    mysql_close ($Link);
    ?>
    As far as i can see line 14 is
    PHP Code:
    if (mysql_create_db ($DBName$Link)) { 
    Any ideas as I'm just starting out on this stuff. I have ordered sitepoints book but I'm using another until I get it.

    Cheers Kili

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2004
    Location
    Abilene, TX
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Replace:

    PHP Code:
    if (mysql_create_db ($DBName$Link)) { 
    With This:

    PHP Code:
    if (mysql_create_db($DBName)) { 
    Reg

    "I don't care how many beers you've had...
    Get your chickens out of my lawn!"

  3. #3

    Join Date
    Oct 2003
    Location
    €uroLand
    Posts
    1,340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This message indicates that your PHP version was not compiled with MySQL support. Which version are you running on which platform?

  4. #4
    SitePoint Guru kili's Avatar
    Join Date
    Jan 2004
    Location
    Damn I need a Crap
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks reg. The book I'm using suggests that $link should be there to close the statment as good practice.

    drzoid
    Operating systemLinux
    Kernel version2.4.28-ow1
    Machine Type i686
    Apache version1.3.33 (Unix)
    PERL version5.8.1
    MySQL version4.0.22-standard

    cheers

    Kili

  5. #5

    Join Date
    Oct 2003
    Location
    €uroLand
    Posts
    1,340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But which PHP version?

  6. #6
    SitePoint Guru kili's Avatar
    Join Date
    Jan 2004
    Location
    Damn I need a Crap
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Php 4.3.9


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •