Results 1 to 4 of 4

Thread: need help with this code
      
   

  1. #1
    Join Date
    Mar 2009
    Posts
    35

    Question need help with this code

    hi, this is my first try at php and just need to know is this code right as im getting errors but dont know if its my code or the sever side


    <?php

    //CONNECT MYSQL and SELECT TABLE;

    $host = "localhost"; //host name;
    $username = "test"; //mysql server login name;
    $password = "test"; //mysql server login password;

    //database Name;

    $database = "test";

    //PREPARE sql statement;

    $sql1 = "CREATE DATABASE $database";

    //EXECUTE sql statement;

    $exq1 = mysql_query($sql1);

    //reply us the database is created or not;

    if($exq1) {

    echo "database created";

    } else {

    echo "error while create database";

    }

    ?>
    T12

  2. #2
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,080

    Default Re: need help with this code

    VH has Cpanel, which doe NOT allow creation of Databases through a query.

    You need to create your database through CPanel.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  3. #3
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,116

    Default Re: need help with this code

    You should be able to create the database manually through a script, using your cpanel username/password in the script.

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

  4. #4
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,080

    Default Re: need help with this code

    Hm.... I can't be certain, but i believe not. Even phpMyAdmin which by default uses the cpanel usename / password, has privilleges to create a new database.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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