THERE ARE SOME PROBLEM IN CREATION OF DATABASE

Somesh

Total Post:21

Points:147
Posted by  Somesh
MYSQL 
 2540  View(s)
Ratings:
Rate this:
how we create database in mysql with php
please give syntex
thanks in advance
  1. Amit Singh

    Post:103

    Points:721
    Re: There are some problem in creation of database

    Create database between mysql and php
    using syntax
    Create database databaseName

    we write syntax in php for creation of database
     Example
    <?php
    $con = mysql_connect("localhost","sa","sa");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }

    if (mysql_query("CREATE DATABASE my_db",$con)) //Create database and check the condition
      {
      echo "Database created";
      }
    else
      {
      echo "Error creating database: " . mysql_error();
      }

    mysql_close($con);
    ?>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!