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

How to register a variable in PHP session?

959


How to connect to a url in php?

988


Explain the difference between urlencode and urldecode?

1042


Explain me is it possible to destroy a cookie?

946


What is pdo classes?

1087


What is a controller in php?

986


Write a program in php to reverse a number?

984


How can you encrypt password using php?

1042


What is prepare in php?

1007


How to merge values of two arrays into a single array?

1008


How many functions are there in php?

985


What is the difference between htmlentities() and htmlspecialchars()?

991


How to execute a php script from the command line?

1081


What is nginx and what is it used for?

1009


What are sql injections, how do you prevent them and what are the best practices?

1052