Home > DeveloperSection > Forums > There are some problem in creation of database
Somesh

Total Post:21

Points:147
Posted on    October-26-2010 9:51 AM

 MYSQL MYSQL 
Ratings:


 1 Reply(s)
 1456  View(s)
Rate this:
how we create database in mysql with php
please give syntex
thanks in advance


Amit Singh

Total Post:103

Points:721
Posted on    November-08-2010 12:38 AM

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);
?>















Recent Activities


Kamlakar Singh added new Blog Convert Text Document to PDF File   10 days ago

Kamlakar Singh added new Article Introduction to Backbone.js   10 days ago

Kamlakar Singh added new Question Explain the AdRotator Control.   11 days ago

Don't want to miss updates? Please click the below button!