Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How can we create a database using PHP and mysql?

Answer Posted / ram

mysql_create_db -- Create a MySQL database
syntax: bool mysql_create_db ( string database_name [,
resource link_identifier])
<?php
$con=mysql_connect("localhost","root","");

if(!$con)
{
die("could not connect:".mysql_error());
}
$dbname='CREATE DATABASE prasad';

if(mysql_query($dbname,$con))
{
echo "Database Created successfully";
}
else
{
echo 'error message:' .mysql_error();
}
?>

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are some new features introduced in php7?

8745


Tell me what is pear?

963


Explain me what is sql injection?

993


What are html entities?

892


What is the difference between require_once and require in php?

1037


Does php use html?

921


What is phpsessid?

925


How to Pass JSON Data in a URL using CURL in PHP?

1020


What are the differences between php3 and php4 and php5? What is the current stable version of php? What advance thing in php7?

1005


Explain the difference between $var and $$var?

911


What's the best method for sanitizing user input with php?

877


What does the unset() function means?

1060


What is the ioncube php loader?

987


Echo is used to Display message on screen. Which is used with echo to not output the trailing newline?

1003


What are computer variables?

900