Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2012

    Unanswered: Creating Database But Confused So much

    PHP Code:

     if (
    is_null($db_post) && empty($db_post))
    $db_post) && (!$db_post==""))
    "Database Not Exist";
    I have very serious issue i want that when the user submit the form

    if the $db_post empty then it set flag to 1

    if the $db_post is not empty if user wrote some value like db then it check whether the database exist then it set to flag 1.

    but if not exist the database it show database not exists let us create. and set flag to 1 so it create database.

    please help for this criteria

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    so when you select the DB you need to check the mysql error to see if the command worked or reported a problem. the most likely faults are going to be either can't find the db or inadequate / no permisssions.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Apr 2013


    Here is a simple script for creating a database as shown below -
    $dbhost = 'localhost:3036';
    $dbuser = 'root';
    $dbpass = 'rootpassword';
    $con = mysql_connect($dbhost, $dbuser, $dbpass);
    if(! $con )
      die('Could not connect: ' . mysql_error());
    echo 'Connected successfully';
    $sql = 'CREATE Database test_db';
    $retval = mysql_query( $sql, $con );
    if(! $retval )
      die('Could not create database: ' . mysql_error());
    echo "Database test_db created successfully\n";
    Use validation service as you tried above to verify whether given database name is exist or not - If it exists echo "Given database name exists", If not allow to create new database with that given name.

    For more details, just go here:

Posting Permissions

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