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 is Mcrypt used for?

952


Why do we use interface in php?

921


What is singleton pattern in php?

848


What is final keyword in php?

963


How to run a php script?

952


What is binary safe function in php?

1005


What is php.ini & .htacess file?

992


How do you remove whitespace from the beginning and end of a $string variable?

925


What are Routines?

2191


How is the ternary conditional operator used in php?

957


Does php support function overloading?

916


How can you encrypt password using php?

992


Is it possible to destroy a cookie?

934


What is trait in php?

927


Is php free to use?

961