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 difference between mysqli and mysql?

1066


How to pass variables by references?

998


How to find the index of an element in an array php?

1005


What is properties of class?

1061


What is polymorphism php?

990


What is php how it works?

1022


Do you know is it possible to extend the execution time of a php script?

1049


Do while loops php?

981


What is the difference between array_pop() and array_push()?

1215


How can you encrypt password using php?

1050


What is csrf cookie?

918


Tell us how to create an array of a group of items inside an html form?

978


How can we determine whether a php variable is an instantiated object of a certain class?

949


What is difference between static and constant in php?

999


How do I stop a php script?

966