How can we create a database using PHP and mysql?

Ads
 

How can we create a database using PHP and mysql?

How can we create a database using PHP and mysql?

View Answers

November 15, 2010 at 4:00 PM

Hi everyone,

Using mysqlcreatedb($databaseName) we can create Mysql database.

Example :

<?php
$connection = mysql_connect("localhost","root","root");
if (!$connection)
  {
  die('Could not connect: ' . mysql_error());
  }

if (mysql_query("CREATE DATABASE database_name",$connection))
  {
  echo "Database created";
  }
else
  {
  echo "Error in creating database: " . mysql_error();
  }

mysql_close($connection);
?>

Thanks

Ads









Related Tutorials/Questions & Answers:
How to Create Instance using PHP
how to connect to database in php using mysql
Advertisements
how we can create website through java
How to create bar chart using database values
how to create a php script to download file from database mysql
how to create a php script to download file from database mysql
how can create album in java by using Stack ....
how to create database and table using jsp
how to store and retrieve images int and from the database using php
How to Create Login/ Registration Form using PHP and MYSQL
How can we solve this puzzle using java ?
Pagination without using database in php
we can create our own header file in java?n how to create?
Video Tutorial: How to create a database in MySQL using Command prompt?
what is the mysql in the database using php
what is the mysql in the database using php
How we can integrate ASP .net website to payment gateway using SOAP xml request and response using wsdl.
How to Create Dynamic URLs in PHP?
Can we use Jmeter for testing a PHP website???
how to create bar chart in jsp using msaccess database
How can I paginate a table which has shown in a div through Ajax in client side without using database
How can I access databse through JSP. I am using postgresql-8.4.4-1-windows as database and jboss-4.0.5.GA as server.
User Registration Form Using JSP(JspBeans) after that how i can insert in database
How to Using timezone_location_get() PHP
how to create a php script to download file
how to create using jsp
PHP Ajax and Database
How to populate text fields using php code?
how to create a user registration form in php
JDBC : Create Database Example
MySQL Create Database

Ads